fix(mir): PHI検証panic修正 - update_cfg()を検証前に呼び出し

A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新

修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351

根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic

解決策:
- 各debug_verify_phi_inputs呼び出し前に
  if let Some(func) = self.current_function.as_mut() {
      func.update_cfg();
  }
  を挿入してCFGを同期

影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
This commit is contained in:
nyash-codex
2025-11-01 13:28:56 +09:00
parent 149ec61d4d
commit 6a452b2dca
174 changed files with 2432 additions and 1014 deletions

View File

@ -18,7 +18,7 @@ static box FlowRunner {
if ds == "" { return null }
local acc = 0
local i = 0
loop(i < ds.size()) { acc = acc * 10 + ("0123456789".indexOf(ds.substring(i,i+1))) i = i + 1 }
loop(i < ds.length()) { acc = acc * 10 + ("0123456789".indexOf(ds.substring(i,i+1))) i = i + 1 }
return acc
}
@ -41,7 +41,7 @@ static box FlowRunner {
if j.indexOf("\"__dev__\":1") >= 0 { return j }
if ast_json != null && ast_json.indexOf("\"__cli_dev__\":1") >= 0 {
if j.substring(0,1) == "{" {
local payload = j.substring(1, j.size())
local payload = j.substring(1, j.length())
return "{\"__dev__\":1," + payload
}
}