docs: Phase 195 implementation status + Phase 196 (Select bug) planning

Phase 195 implementation complete (Lowerer side):
- loop_with_if_phi_minimal.rs: multi-carrier PHI generation (sum + count)
- pattern3_with_if_phi.rs: dynamic single/multi-carrier handling
- ExitLine/CarrierVar.join_id: NO CHANGES NEEDED (existing infra worked!)
- YAGNI principle validated - PhiGroupBox was not necessary

Blocker discovered: Nested Select→Branch+Phi conversion bug
- JoinIR correctly generates: ValueId(20) = phi [(bb3, 14), (bb4, 18)]
- MIR incorrectly produces: %27 = phi [%28, bb8], [%32, bb9] (undefined)
- Root cause: joinir_block.rs Select expansion (bridge layer)
- NOT a Phase 195 issue - pre-existing bug in Select conversion

Phase 196 planned (NEW):
- 196-1: Document select_expansion / instruction_rewriter responsibilities
- 196-2: Formalize "1 Select = 3 blocks + 1 PHI" interface
- 196-3: Debug block reuse / block ID mapping
- 196-4: Fix and E2E test (phase195_sum_count.hako → 72)

Documentation updates:
- phase195-pattern3-extension-design.md: Implementation Status section
- CURRENT_TASK.md: Phase 195 complete + Phase 196 TODO
- joinir-architecture-overview.md: P3 Lowerer complete, bridge blocker noted

Key insight: "Pattern side is done, problem is in bridge side"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-09 13:58:31 +09:00
parent 8e837accdd
commit dc4eda9cdc
3 changed files with 101 additions and 18 deletions

View File

@ -523,11 +523,12 @@ JoinIR は Rust 側だけでなく、将来的に .hako selfhost コンパイラ
- Deferred loops: _parse_array, _parse_object (multiple MethodCalls)
- 詳細: phase194-loop-inventory.md, phase194-jsonparser-deployment.md
5. **Pattern 3 拡張(複数キャリア対応)** → Phase 195 設計中
5. **Pattern 3 拡張(複数キャリア対応)** → Phase 195 Lowerer 完了、Phase 196 待ち
- 目的: P3If-Else PHIで 2-3 個の Carrier を同時処理
- 設計判断: ExitLine 拡張で対応PhiGroupBox は作らない - YAGNI 原則)
- 対象: _parse_stringflag+buffer、if-sumsum+count
- Phase 195-impl で実装予定
- **Lowerer 側完了**: multi-carrier PHI 生成sum + count
- **ExitLine**: 変更不要(既存インフラ活用)✅
- **Blocker**: JoinIR→MIR の Select 変換バグPhase 196 で修正予定
- パターン側は終わり、問題は bridge 側
6. **JsonParser 残り複雑ループへの適用Phase 195+, 200+**
- Phase 200+: ConditionEnv 拡張 (function-scoped variables) → _parse_number, _atoi