Phase 33-2: JoinInst::Select implementation + minimal If JoinIR lowering

Implementation:
- Add JoinInst::Select variant to JoinIR schema
- Implement Select execution in JoinIR Runner (Bool/Int cond support)
- Add Select handling in JoinIR→MIR Bridge (4-block structure)
- Create test cases (joinir_if_select_simple/local.hako)
- Add dev toggle NYASH_JOINIR_IF_SELECT=1
- Create lowering infrastructure (if_select.rs, stub for Phase 33-3)

Tests:
- 3/3 unit tests pass (test_select_true/false/int_cond)
- Integration tests pass (RC: 0)
- A/B execution verified (existing if_phi vs JoinIR Select)

Files changed:
- New: apps/tests/joinir_if_select_{simple,local}.hako
- New: src/mir/join_ir/lowering/if_select.rs
- Modified: src/mir/join_ir/{mod,json,runner,vm_bridge}.rs
- Modified: src/config/env.rs (joinir_if_select_enabled)
- Modified: docs/reference/environment-variables.md

Phase 33-3 ready: MIR pattern recognition + auto-lowering pending

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-27 02:58:38 +09:00
parent 0c252406ef
commit 35cd93a37a
13 changed files with 642 additions and 47 deletions

View File

@ -209,6 +209,20 @@ pub fn joinir_vm_bridge_debug() -> bool {
env_bool("NYASH_JOINIR_VM_BRIDGE_DEBUG")
}
/// JoinIR LLVM experiment mode. When enabled with NYASH_JOINIR_EXPERIMENT=1,
/// enables experimental JoinIR→MIR'→LLVM path for specific functions (e.g., Main.skip/1).
/// This is a dev-only toggle for testing PHI normalization via JoinIR in the LLVM path.
/// Set NYASH_JOINIR_LLVM_EXPERIMENT=1 to enable.
pub fn joinir_llvm_experiment_enabled() -> bool {
env_bool("NYASH_JOINIR_LLVM_EXPERIMENT")
}
/// Phase 33: JoinIR If Select 実験の有効化
/// Set NYASH_JOINIR_IF_SELECT=1 to enable experimental If/Else → Select lowering.
pub fn joinir_if_select_enabled() -> bool {
env_bool("NYASH_JOINIR_IF_SELECT")
}
// VM legacy by-name call fallback was removed (Phase 2 complete).
// ---- Phase 11.8 MIR cleanup toggles ----