feat(joinir): Phase 257 P1.1/P1.2/P1.3 - Pattern6 SSOT + LoopHeaderPhi CFG fix

P1.1: Pattern6 false positive fix (SSOT approach)
- can_lower() now calls extract_scan_with_init_parts() for SSOT
- index_of_string/2 no longer triggers false positive
- Graceful fall-through with Ok(None)

P1.2: LoopHeaderPhi CFG-based correction
- Step 0: Manual successor update from terminators
- CFG-based entry predecessor computation (header_preds - latch)
- Multi-entry-pred support (bb0 host + bb10 JoinIR main)
- Explicit host_entry_block addition (emit_jump runs after finalize)

P1.3: Smoke script validation
- phase254_p0_index_of_vm.sh: --verify + VM error detection
- phase257 smokes updated

Acceptance criteria (all PASS):
 phase254_p0_index_of_min.hako verify
 phase257_p0_last_index_of_min.hako verify
 ./tools/smokes/v2/run.sh --profile quick (no Pattern6 false positive)

Technical discovery:
- Host entry block (bb0) Jump set in Phase 6 (after finalize)
- instruction_rewriter bypasses set_terminator(), skips successor update

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-20 23:30:27 +09:00
parent 9ba89bada2
commit 73ddc5f58d
10 changed files with 492 additions and 71 deletions

View File

@ -6,6 +6,28 @@
- Phase 143-loopvocab P3+: 条件スコープ拡張impure conditions 対応)
- 詳細: `docs/development/current/main/30-Backlog.md`
## 2025-12-20Phase 257 P1.1/P1.2/P1.3 完了 ✅
- **P1.1**: Pattern6 SSOT fixfalse positive 根治)
- `can_lower()``extract_scan_with_init_parts()` を呼び出して SSOT を確立
- `index_of_string/2` の誤検出が解消(`Ok(None)` で graceful fall-through
- **P1.2**: LoopHeaderPhi CFG correctionentry predecessor 自動計算)
- Step 0: `update_successors_from_terminator()` を手動実行instruction_rewriter が set_terminator() をバイパスするため)
- CFG から entry predecessors を計算header_preds - latch_block
- 複数 entry preds 対応bb0 host + bb10 JoinIR main
- host_entry_block を明示的に追加emit_jump が finalize() 後に実行されるため)
- **P1.3**: Smoke script validation既存実装確認
- `phase254_p0_index_of_vm.sh``--verify` + VM error detection で false positive 回避
**検証結果**
-`phase254_p0_index_of_min.hako` verify → PASS
-`phase257_p0_last_index_of_min.hako` verify → PASS
-`./tools/smokes/v2/run.sh --profile quick` → Pattern6 false positive なし(別の未サポートパターンで止まる)
**技術的発見**
- JoinIR merge では host entry block (bb0) の Jump が Phase 6 で設定されるため、Phase 4.5 の finalize() 時点で CFG に現れない
- 解決策:`builder.current_block` を捕捉し、CFG 計算後に明示的に entry_preds へ追加
## 2025-12-19Phase 146/147 完了 ✅
- Phase 146 README: `docs/development/current/main/phases/phase-146/README.md`
@ -70,6 +92,12 @@
- Phase 257 README: `docs/development/current/main/phases/phase-257/README.md`
- Goal: `StringUtils.last_index_of/2` を JoinIR で受理し、`--profile quick` を緑に戻す
- Investigation最小再現/論点): `docs/development/current/main/investigations/phase-257-last-index-of-loop-shape.md`
- Status: Pattern6 reverse scan + PHI/CFG 安定化は完了(最初の FAIL は次へ移動)
- Current first FAIL: `json_lint_vm / StringUtils.is_integer/1`nested-if + loop pattern, unsupported
## 2025-12-20Phase 258is_integer nested-if + loop🔜
- Phase 258 README: `docs/development/current/main/phases/phase-258/README.md`
## 2025-12-19Phase 254index_of loop pattern✅ 完了Blocked by Phase 255