Files
hakorune/docs/development
tomoaki 757193891f feat(llvm/phi): Phase 277 P1 - fail-fast validation for PHI strict mode
## 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>
2025-12-22 14:48:37 +09:00
..

Nyash Development Documentation 🔧

開発者向けの進行中タスクと開発計画ドキュメントです。

📂 ディレクトリ構造

current/

  • CURRENT_TASK.md - 現在進行中のタスク
  • アクティブな開発作業の詳細
  • 最新の実装状況

roadmap/

  • phases/ - フェーズ別開発計画
    • phase-8/ - AST→MIR変換
    • phase-9/ - VM/JIT実装
    • phase-10/ - AOT最適化
  • native-plan/ - ネイティブビルド計画
    • 実行バックエンド統合
    • パフォーマンス目標

proposals/

  • RFCRequest for Comments
  • 新機能提案
  • 設計ディスカッション

🎯 重要な参照先

  • 進行状況: current/CURRENT_TASK.md
  • 開発計画: roadmap/phases/
  • 技術提案: proposals/
  • ドキュメントのステータス/入口ポリシー: doc-status-policy.md
  • JoinIR / Selfhost の入口: current/main/01-JoinIR-Selfhost-INDEX.md

📝 注意事項

このディレクトリの内容は開発中であり、頻繁に変更されます。 安定した仕様はreference/を参照してください。