VM: PHI strict default-ON + loop-header PHI fix; add VM step budget; StringBox.lastIndexOf; docs + strict smoke

- PHI strict: default ON, disable via HAKO_VM_PHI_STRICT=0 (alias NYASH_VM_PHI_STRICT=0)
- LoopForm: insert initial header PHI (preheader input) and rebind vars before condition; seal updates PHI inputs; avoid duplicate PHIs by replace
- MIR interpreter: add HAKO_VM_MAX_STEPS (alias NYASH_VM_MAX_STEPS) fail-fast budget to prevent infinite loops
- StringBox.lastIndexOf implemented (rfind, returns -1 when not found) in VM handlers
- Smokes: add strict/core/vm_phi_strict_smoke.sh (opt-in); quick remains green 120/120
- Docs: lang/src/vm/README.md and CURRENT_TASK.md updated with PHI strict policy and step budget
This commit is contained in:
nyash-codex
2025-11-02 11:01:03 +09:00
parent 66b2a115ae
commit 484bea946d
5 changed files with 133 additions and 2 deletions

View File

@ -52,6 +52,14 @@ Toggles and Canaries
ビルトイン `MapBox` の内部データ長を返すフォールバックを持つためplugins=OFF でも0 固定にはならない。
- Errors: VM 実行/JSON読込エラー時は非0で終了FailFast
PHI Strict既定ON
- 目的: ループ/分岐における PHI 入力の不整合pred 欠落や自己参照)を早期に検出し、クラッシュや未定義使用を防止する。
- 既定: ON何も設定しない場合は厳格
- 無効化(開発・暫定用途のみ):
- `HAKO_VM_PHI_STRICT=0` または `NYASH_VM_PHI_STRICT=0`
- ON 指定: `1|true|on|yes` 等、OFF 指定: `0|false|off|no` 等を受理
- 実装: `src/backend/mir_interpreter/exec.rs`PHI 適用時に pred 不一致を FailFast
Quick profile optin switches (smokes)
- `SMOKES_ENABLE_LOOP_COMPARE=1` — Direct↔Bridge parity for loops (sum/break/continue/nested/mixed)
- `SMOKES_ENABLE_LOOP_BRIDGE=1` — Bridge(JSON v0) loop canaries (quiet; last numeric extraction)