|
|
e2508f9f08
|
feat(joinir): Phase 215-2 ExprResult exit contract for Pattern 3
Implements Phase 215 Task 215-2: Wire expr_result exit line through
ExitMeta → JoinInlineBoundary → ExitLine → MIR return for Pattern 3.
## Changes
### Fix 1: JoinIR Lowerer (loop_with_if_phi_if_sum.rs:312)
- Changed `carrier_only()` → `with_expr_result(sum_final, exit_meta)`
- Marks sum final value as expr_result for propagation
### Fix 2: Boundary Builder (pattern3_with_if_phi.rs:176-191)
- Added `.with_expr_result(Some(expr_id))` to JoinInlineBoundaryBuilder
- Passes expr_result to boundary for ExitLineReconnector
### Fix 3: Final Return (pattern3_with_if_phi.rs:195-219)
- Changed from always returning Void to conditional return:
- Expr-position loops: Return merge_result ValueId
- Statement-position loops: Return Void
- Matches Pattern 2 behavior
## Test Results
Primary target:
- phase212_if_sum_min.hako: RC=2 achieved ✅
Regression tests:
- loop_if_phi.hako: RC=2 (existing behavior maintained) ✅
- Pattern 1/2/3 tests: All PASS ✅
## Architecture
Pattern 3 now follows the same ExprResult Exit Contract as Pattern 2:
1. JoinIR lowerer creates expr_result with `with_expr_result()`
2. Boundary builder passes expr_result with `.with_expr_result()`
3. Conversion pipeline returns merge result containing exit PHI ValueId
4. Pattern dispatcher conditionally returns expr_result or Void
This enables:
- Expr-position loops: Loop result propagates to caller
- Statement-position loops: Loop updates variable_map only (returns Void)
- Unified contract: Patterns 2 and 3 follow same expr_result flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-10 01:40:18 +09:00 |
|