## Summary Implemented fail-fast validation for PHI ordering and value resolution in strict mode. ## Changes ### P1-1: Strict mode for "PHI after terminator" - File: `src/llvm_py/phi_wiring/wiring.py::ensure_phi` - Behavior: `NYASH_LLVM_PHI_STRICT=1` → RuntimeError if PHI created after terminator - Default: Warning only (no regression) ### P1-2: Strict mode for "fallback 0" - File: `src/llvm_py/phi_wiring/wiring.py::wire_incomings` - Behavior: Strict mode forbids silent fallback to 0 (2 locations) - Location 1: Unresolvable incoming value - Location 2: Type coercion failure - Error messages point to next debug file: `llvm_builder.py::_value_at_end_i64` ### P1-3: Connect verify_phi_ordering() to execution path - File: `src/llvm_py/builders/function_lower.py` - Behavior: Verify PHI ordering after all instructions emitted - Debug mode: Shows "✅ All N blocks have correct PHI ordering" - Strict mode: Raises RuntimeError with block list if violations found ## Testing ✅ Test 1: strict=OFF - passes without errors ✅ Test 2: strict=ON - passes without errors (no violations in test fixtures) ✅ Test 3: debug mode - verify_phi_ordering() connected and running ## Scope - LLVM harness (Python) changes only - No new environment variables (uses existing 3 from Phase 277 P2) - No JoinIR/Rust changes (root fix is Phase 279) - Default behavior unchanged (strict mode opt-in) ## Next Steps - Phase 278: Remove deprecated env var support - Phase 279: Root fix - unify "2本のコンパイラ" pipelines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
Nyash CLI Options Quick Reference
最終更新: 2025-08-23
基本
file: 実行するNyashファイル(位置引数)--backend {interpreter|vm|llvm}: 実行バックエンド選択(既定: interpreter)--debug-fuel {N|unlimited}: パーサーのデバッグ燃料(無限ループ対策)
MIR関連
--dump-mir: MIRを出力(実行はしない / compile-only。実行経路SSOTの確認はNYASH_VM_DUMP_MIR=1 --backend vmを優先)--verify: MIR検証を実施--mir-verbose: 詳細MIR出力(統計など)
VM関連
--vm-stats: VM命令統計を有効化(NYASH_VM_STATS=1)--vm-stats-json: VM統計をJSONで出力(NYASH_VM_STATS_JSON=1)
GC
--gc {auto|rc+cycle|minorgen|stw|rc|off}: GCモード(既定:auto→ rc+cycle)rc+cycle: 参照カウント + 循環回収(推奨・安定)minorgen: 高速向けの軽量世代別(Gen‑0移動、上位非移動)stw: 検証用の非移動Mark‑Sweep(開発者向け)rc: 循環回収なしのRC(比較用)off: 自己責任モード(循環はリーク)
- 関連ENV
NYASH_GC_MODE(CLIが優先)NYASH_GC_METRICS/NYASH_GC_METRICS_JSONNYASH_GC_ALLOC_THRESHOLD- 詳細:
docs/reference/runtime/gc.md
WASM/AOT
--compile-wasm: WATを出力--compile-native/--aot: AOT実行ファイル出力(要wasm-backend)--output, -o FILE: 出力先を指定
ベンチマーク
--benchmark: バックエンド比較ベンチを実行--iterations N: ベンチ実行回数(既定: 10)
使用例
# インタープリターで実行
nyash program.hako
# VMで実行 + 統計をJSON出力
nyash --backend vm --vm-stats --vm-stats-json program.hako
# MIRを出力
nyash --dump-mir --mir-verbose program.hako
# ベンチマーク
nyash --benchmark --iterations 100
詳細は docs/reference/architecture/execution-backends.md も参照してください。
参考: nyash --help スナップショット
- docs/tools/nyash-help.md