Files
hakorune/docs/guides/phi-off-troubleshooting.md
Selfhosting Dev f0608e9bb1 feat: Phase 2.4 レガシーアーカイブ整理完了(151MB削減)
## 🎉 完了項目
-  plugin_box_legacy.rs削除(7.7KB、参照ゼロ確認済み)
-  REMOVEDコメント整理(encode.rs簡潔化)
-  venv削除(143MB節約、.gitignoreは既存)
-  llvm_legacyスタブ化(8KB、compile_error!による安全化)

## 🏆 成果
- **リポジトリサイズ改善**: 151MB削減
- **コード整理**: レガシーコード安全にアーカイブ
- **プラグインファースト**: StrictPluginFirst継続動作

##  検証完了
- cargo build --release --features llvm (警告のみ、エラーなし)
- LLVMハーネス実行: print出力正常
- プラグイン動作: StringBox等正常動作

codex先生の戦略に従った安全な段階的削除を実行

Co-Authored-By: codex <noreply@anthropic.com>
2025-09-24 14:13:15 +09:00

28 lines
1.5 KiB
Markdown
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.

## PHI-off Troubleshooting
Scope: MIR PHI-off (edge-copy) policy with LLVM harness PHI synthesis.
> Phase15 では PHI-on が既定だよ。このガイドは `NYASH_MIR_NO_PHI=1` を明示してレガシー edge-copy モードを再現しているときだけ参照してね。
Symptoms and Hints
- Merge block contains self-copy to merged value
- Symptom: Verifier (edge-copy strict) complains or trace shows unexpected write at merge.
- Check: Enable `NYASH_VERIFY_EDGE_COPY_STRICT=1` and locate offending merge block.
- Fix: Ensure copies are inserted in predecessors only; merge binds the already-defined dst.
- Missing predecessor copy into merged destination
- Symptom: Edge-copy strict reports missing pred; phi-trace checker shows `missing=[...]`.
- Check: `tools/phi_trace_check.py --file <trace.jsonl> --summary` (or drop `--summary` to see diffs on error).
- Fix: Builder/Bridge must insert `Copy{dst=merged}` at that predecessor end.
- Synthesized zero in PHI wiring
- Symptom: phi-trace shows `zero=1` or checker with `--strict-zero` fails.
- Check: Ensure the source value exists at predecessor end (resolve_i64/snapshot); add casts/boxing at pred end.
- Fix: Route casts at pred end (not at merge); for strings/handles, ensure i64 handle flows across blocks.
Tools
- JSON trace: set `NYASH_LLVM_TRACE_PHI=1` and `NYASH_LLVM_TRACE_OUT=<path>`
- One-shot: `tools/phi_trace_run.sh <app.nyash> [--strict-zero]`
- Strict verifier (PHI-off): `NYASH_VERIFY_EDGE_COPY_STRICT=1 cargo test --lib`