Files
hakorune/docs/development
nyash-codex fa8727c2f8 docs: Phase 196 Select expansion bug fix instruction document
Phase 196 investigation & fix plan for JoinIR→MIR Select conversion bug:
- Goal: Fix "correct PHI in JoinIR → undefined PHI inputs in MIR" issue
- Scope: Bridge layer only (join_ir_vm_bridge / merge line)

Task breakdown:
- 196-1: Minimal reproduction case (phase195_sum_count.hako)
  - Record expected JoinIR structure (ValueIds, block IDs)
  - Record broken MIR structure (undefined PHI inputs)
  - Identify which Select instruction causes the bug
- 196-2: Select expansion path analysis (read-only)
  - Locate handle_select in joinir_block.rs
  - Understand "1 Select = 3 blocks + 1 PHI" conversion
  - Document responsibility locations
- 196-3: Fix strategy (no new boxes)
  - Candidate 1: PHI inputs ValueId check (use emit results)
  - Candidate 2: Block reuse vs overwrite (Phase 33-20 lesson)
  - Candidate 3: JoinInlineBoundary remapper usage (remap before PHI)
  - One-at-a-time fix approach
- 196-4: E2E re-verification + regression check
  - phase195_sum_count.hako → 72
  - loop_if_phi.hako (single-carrier P3)
  - P1/P2/P4 representative tests
- 196-5: Documentation updates
  - phase196-select-bug-analysis.md (Before/After)
  - CURRENT_TASK.md (Phase 196 completion)
  - overview (Select expansion line verified)

Design principles:
- Minimal changes (existing Select expansion logic only)
- Focus on one candidate at a time (Fail-Fast)
- Explicit errors (remapper.get_value() must not silently fail)
- Document-driven (record Before/After for future reference)

Success criteria:
- phase195_sum_count.hako outputs 72
- No SSA-undef / PHI errors
- No regressions in P1/P2/P3/P4 tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 14:07:42 +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/

📝 注意事項

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