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:
@ -235,6 +235,14 @@ box ParserBox {
|
||||
|
||||
// === Top-level program parser ===
|
||||
parse_program2(src) {
|
||||
// Dev-only: guaranteed direct marker before any env operations
|
||||
{
|
||||
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
|
||||
if marker_enabled != null && ("" + marker_enabled) == "1" {
|
||||
print("[stageb/trace] ParserBox.parse_program2:entry")
|
||||
}
|
||||
}
|
||||
|
||||
// Shallow recursion guard for Stage‑B / selfhost callers:
|
||||
// prevent accidental self-recursion in ParserBox.parse_program2.
|
||||
{
|
||||
@ -247,11 +255,36 @@ box ParserBox {
|
||||
env.set("HAKO_STAGEB_PARSER_DEPTH", "1")
|
||||
}
|
||||
|
||||
// Dev-only: marker before trace_enabled() call
|
||||
{
|
||||
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
|
||||
if marker_enabled != null && ("" + marker_enabled) == "1" {
|
||||
print("[stageb/trace] ParserBox.parse_program2:before_trace_enabled")
|
||||
}
|
||||
}
|
||||
|
||||
local trace = me.trace_enabled()
|
||||
|
||||
// Dev-only: marker after trace_enabled() call
|
||||
{
|
||||
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
|
||||
if marker_enabled != null && ("" + marker_enabled) == "1" {
|
||||
print("[stageb/trace] ParserBox.parse_program2:after_trace_enabled trace=" + ("" + trace))
|
||||
}
|
||||
}
|
||||
|
||||
// Inline skip_ws to avoid VM bug: method-with-loop called from within loop
|
||||
local i = 0
|
||||
local n = src.length()
|
||||
|
||||
// Dev-only: marker before src.length() operations
|
||||
{
|
||||
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
|
||||
if marker_enabled != null && ("" + marker_enabled) == "1" {
|
||||
print("[stageb/trace] ParserBox.parse_program2:got_src_length n=" + ("" + n))
|
||||
}
|
||||
}
|
||||
|
||||
if trace == 1 {
|
||||
print("[parser/trace:program2] start len=" + ("" + n) + " stage3=" + ("" + me.stage3))
|
||||
}
|
||||
@ -266,6 +299,14 @@ box ParserBox {
|
||||
}
|
||||
}
|
||||
|
||||
// Dev-only: marker before main loop
|
||||
{
|
||||
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
|
||||
if marker_enabled != null && ("" + marker_enabled) == "1" {
|
||||
print("[stageb/trace] ParserBox.parse_program2:before_main_loop i=" + ("" + i))
|
||||
}
|
||||
}
|
||||
|
||||
local body = "["
|
||||
local first = 1
|
||||
local cont_prog = 1
|
||||
|
||||
Reference in New Issue
Block a user