Files
hakorune/lang/src/runner
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
..

Runner Facade (ScriptFirst) — Phase 20.10

Responsibility

  • Provide a thin, optin runner facade in Hakorune (script) to orchestrate entry selection and pre/post hooks.
  • Delegates actual execution to existing backends (Rust VM / LLVM). No behavior change by default.

Gate

  • Enable with HAKO_SCRIPT_RUNNER=1 (default OFF). In 20.10 this runner is not wired by default; wiring will be added behind the gate.

Contracts (draft)

  • Entry: Runner.run(entry: string, args: array<string>) -> i64
  • Prehooks: validate entry, shape args, emit diagnostics (short tokens) on failure.
  • Posthooks: normalize result (e.g., quiet result mode), optional metrics/logging.

Notes

  • Keep this layer pure and free of platform I/O. Defer I/O to CABI utilities (hako_*).
  • FailFast: invalid entry/args → emit short diagnostics and return nonzero.
  • BoxFirst: add adapters for boundary objects (args, env) instead of sprinkling conditions.

Short Diagnostics & Observability

  • Preinvoke emits stable oneliners for smokes:
    • Success: [script-runner] invoke (stdout)
    • Failure (dev injection or panic): [script-runner] invoke: FAIL (stdout)
  • The runner wiring prints a gate trace to stderr: [script-runner] gate=on (facade).

Devonly toggle (TTL: Phase 20.10 bringup)

  • HAKO_SCRIPT_RUNNER_FORCE_FAIL=1 forces the preinvoke to emit [script-runner] invoke: FAIL without executing the facade program.
  • Scope: tests/smokes only. Remove after runner wiring stabilizes (documented here as a temporary aid).