feat(joinir): Phase 190 - LoopExitBinding boxification
Formalize exit PHI → variable_map reconnection with explicit LoopExitBinding
structure. Eliminates hardcoded variable names and prepares for Pattern 4+
multi-carrier support.
Key changes:
1. **New LoopExitBinding struct**:
- carrier_name: String (e.g., "sum", "count")
- join_exit_value: ValueId (JoinIR exit value)
- host_slot: ValueId (variable_map destination)
Makes it explicit: WHICH variable, FROM where, TO where.
2. **Updated JoinInlineBoundary**:
- Replaced implicit host_outputs: Vec<ValueId>
- With explicit exit_bindings: Vec<LoopExitBinding>
- Old APIs marked #[deprecated] for backward compatibility
3. **Pattern 3 now uses explicit bindings**:
Before: boundary.host_outputs = vec![sum_var_id] // implicit
After: boundary.exit_bindings = vec![LoopExitBinding {
carrier_name: "sum".to_string(),
join_exit_value: ValueId(18),
host_slot: sum_var_id,
}]
4. **merge_joinir_mir_blocks() updated**:
- Consumes exit_bindings instead of bare ValueIds
- Enhanced debug output shows carrier names
- Validates carrier name matches variable_map expectations
Benefits:
- Self-documenting code: bindings explain themselves
- Multi-carrier ready: Pattern 4+ just extend the vec![]
- Type-safe: No implicit semantics
- Debuggable: Explicit carrier name in logs
Test status:
- Build: ✅ SUCCESS (0 errors, 47 warnings)
- Pattern 3: ✅ PASS (no regressions)
- Backward compatibility: ✅ Maintained via #[deprecated]
Prepare for Phase 191: Pattern Router Table and Phase 192: JoinLoopTrace
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -210,6 +210,8 @@ env NYASH_FEATURES=stage3 NYASH_LLVM_USE_HARNESS=1 \
|
||||
| `NYASH_VERIFY_EDGE_COPY_STRICT=1` | OFF | Any | Edge copy 検証を厳格化 |
|
||||
| `NYASH_VERIFY_RET_PURITY=1` | OFF | Any | return ブロックの純粋性検証 |
|
||||
| `NYASH_ME_CALL_ARITY_STRICT=1` | OFF | Any | me.method の arity 不一致でエラー |
|
||||
| `NYASH_MIR_DISABLE_OPT=1` | OFF | Any | MIR Optimizer 全体を無効化(開発/診断用、`src/mir/optimizer.rs`) |
|
||||
| `NYASH_TRACE_VARMAP=1` | OFF | Any | `MirBuilder.variable_map` の状態をトレース出力(`[varmap/<tag>] {name=ValueId(..),..}`)。JoinIR loop 統合のデバッグ用。 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user