fix(mir): Phase 25.1m - Continue PHI修正 & Bug A main(args)ループ修正

**Phase 25.1m: Continue PHI修正**
- seal_phis に continue_snapshots 入力を追加 (loopform_builder.rs)
- LoopShape::debug_validate に continue/break エッジ検証追加 (control_form.rs)
- test_seal_phis_includes_continue_snapshots テスト追加
- 実証テスト成功: balanced scan loop で 228回イテレーション確認

**Bug A修正: main(args) でループ未実行問題**
- LoopBuilder::build_loop で entry → preheader への jump 追加
- decls.rs でデュアル関数作成時のブロック接続修正
- mir_static_main_args_loop.rs テスト追加

**パーサー改善**:
- parser_box.hako に HAKO_PARSER_PROG_MAX ガード追加(無限ループ対策)

🎉 成果:
- Continue 文の PHI predecessor mismatch エラー完全解消
- main(args) パラメータ有りループが正常動作
- Stage-B balanced scan で continue 正常動作確認 (228回イテレーション)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-19 08:04:43 +09:00
parent b086933acb
commit a95fedf26a
10 changed files with 547 additions and 42 deletions

View File

@ -52,8 +52,10 @@ builder.emit_header_phis(ops)?;
// Result: %101 = phi [%100, bb0]; %103 = phi [%102, bb0]; ...
// Pass 4: Seal PHIs after loop body
builder.seal_phis(ops, latch_id)?;
// Result: %101 = phi [%100, bb0], [%101, latch]; %103 = phi [%102, bb0], [%120, latch]
// (merge preheader + continue blocks + latch into header PHIs)
builder.seal_phis(ops, latch_id, &continue_snapshots)?;
// Result: %101 = phi [%100, bb0], [%200, bb_cont], [%101, latch];
// %103 = phi [%102, bb0], [%201, bb_cont], [%120, latch]
```
**Critical Property**: All ValueIds allocated in Pass 1, **before** any MIR emission → **no circular dependencies possible**.