Files
hakorune/lang/src/vm/opt/vm_hot_path.hako
nyash-codex 6a452b2dca 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生成が正常動作
2025-11-01 13:28:56 +09:00

21 lines
652 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// vm_hot_path.hako — VMHotPathBox (v0 skeleton)
// Gate: HAKO_VM_FAST_PATH=1 で将来のホットパス最適化を有効化(現状は no-op
static box VMHotPathBox {
enabled() {
// Accept HAKO_VM_FAST_PATH=1|true|on (case-insensitive)
local v = env.get("HAKO_VM_FAST_PATH")
if !v { return 0 }
local l = v.toLowerCase()
if l == "1" || l == "true" || l == "on" { return 1 }
return 0
}
// Entry point (reserved): future hook to prebuild maps or inject superinstructions (dev only)
prep() {
if !VMHotPathBox.enabled() { return 0 }
// v0: no-op; keep structure for future expansions
return 0
}
}