feat(phase182): Upgrade 3 JOINIR_TARGETS functions from LowerOnly to Exec
Phase 182 implementation: JOINIR_TARGETS expansion for representative paths ## Changes - Stage1UsingResolverBox.resolve_for_source/5: LowerOnly → Exec (default_enabled: true) - StageBBodyExtractorBox.build_body_src/2: LowerOnly → Exec (default_enabled: true) - StageBFuncScannerBox.scan_all_boxes/1: LowerOnly → Exec (default_enabled: true) ## Critical Finding: JOINIR_TARGETS is Loop-Only Discovered that JOINIR_TARGETS is specifically for LOOP lowering only. Adding if-lowering functions (like IfSelectTest.test/1) would be counterproductive because is_loop_lowered_function() exclusion would disable if-lowering entirely. ## Test Results - 4/5 selfhost loop tests: PASS with NYASH_JOINIR_CORE=1 NYASH_JOINIR_STRICT=1 - 1/5 if-select test: FAIL (requires Phase 183 architectural fix - Option A) - No regressions in existing functionality ## Phase 183 Recommendation Implement Option A: Create JOINIR_IF_TARGETS as separate table for if-lowering functions, avoiding the mutual exclusion problem between loop and if lowering. See: docs/private/roadmap2/phases/phase-182/FINDINGS.md for full analysis 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,8 +1,60 @@
|
|||||||
# Current Task
|
# Current Task
|
||||||
|
|
||||||
|
## ⚠️ Phase 182: JOINIR_TARGETS Expansion (Partially Completed - 2025-12-04)
|
||||||
|
|
||||||
|
**Status**: ⚠️ **3/4 Actions Completed** → Critical Architectural Finding Documented
|
||||||
|
|
||||||
|
**Achievement**: Successfully upgraded 3 LowerOnly functions to Exec, but discovered **JOINIR_TARGETS is Loop-Only** - cannot add if-lowering functions without breaking architecture.
|
||||||
|
|
||||||
|
### What Was Completed
|
||||||
|
|
||||||
|
✅ **3/3 LowerOnly → Exec upgrades successful**:
|
||||||
|
- `Stage1UsingResolverBox.resolve_for_source/5` → Exec (default_enabled: true)
|
||||||
|
- `StageBBodyExtractorBox.build_body_src/2` → Exec (default_enabled: true)
|
||||||
|
- `StageBFuncScannerBox.scan_all_boxes/1` → Exec (default_enabled: true)
|
||||||
|
|
||||||
|
✅ **4/4 loop-based tests passing** with `NYASH_JOINIR_CORE=1 NYASH_JOINIR_STRICT=1`:
|
||||||
|
- `apps/tests/loop_min_while.hako`
|
||||||
|
- `apps/tests/peek_expr_block.hako`
|
||||||
|
- `apps/tests/joinir_min_loop.hako`
|
||||||
|
- `apps/tests/string_method_chain.hako`
|
||||||
|
|
||||||
|
✅ **Architectural issue documented** in `docs/private/roadmap2/phases/phase-182/FINDINGS.md`
|
||||||
|
|
||||||
|
### What Was NOT Completed
|
||||||
|
|
||||||
|
❌ **IfSelectTest.test/1 NOT added** to JOINIR_TARGETS (would break if-lowering)
|
||||||
|
|
||||||
|
**Root Cause**: `is_loop_lowered_function()` in `src/mir/join_ir/lowering/mod.rs` excludes ALL functions in JOINIR_TARGETS from if-lowering, regardless of Exec/LowerOnly status. Adding if-functions to JOINIR_TARGETS would disable their if-lowering capability.
|
||||||
|
|
||||||
|
### Critical Finding
|
||||||
|
|
||||||
|
**JOINIR_TARGETS Dual Purpose**:
|
||||||
|
1. ✅ Function whitelist (for JoinIR loop lowering)
|
||||||
|
2. ❌ Function blacklist (for if-lowering exclusion)
|
||||||
|
|
||||||
|
This creates architectural conflicts for functions that need if-lowering.
|
||||||
|
|
||||||
|
### Phase 183 Entry Criteria Status
|
||||||
|
|
||||||
|
**Hard Requirements**:
|
||||||
|
1. ✅ 3/3 LowerOnly → Exec upgrades complete
|
||||||
|
2. ⚠️ 4/5 selfhost tests pass (loop-based only, if-select requires architectural fix)
|
||||||
|
3. ✅ No regression in non-strict mode
|
||||||
|
4. ❌ If-select test NOT unblocked (requires Option A: separate If targets table)
|
||||||
|
|
||||||
|
**Recommendation**: Phase 183 should implement **separate JOINIR_IF_TARGETS table** (Option A in FINDINGS.md) before proceeding with LoopBuilder removal.
|
||||||
|
|
||||||
|
### Files Changed
|
||||||
|
|
||||||
|
- `src/mir/join_ir_vm_bridge_dispatch/targets.rs`: 3 Exec upgrades + loop-only warning added
|
||||||
|
- `docs/private/roadmap2/phases/phase-182/FINDINGS.md`: Comprehensive findings document (300+ lines)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🎉 Phase 181: JoinIR Unification Planning Completed (2025-12-04)
|
## 🎉 Phase 181: JoinIR Unification Planning Completed (2025-12-04)
|
||||||
|
|
||||||
**Status**: ✅ **All 4 Tasks Completed** → Phase 182 Implementation Ready
|
**Status**: ✅ **All 4 Tasks Completed** → Phase 182 Implementation Partially Completed
|
||||||
|
|
||||||
**Summary**: Phase 181 successfully completed comprehensive planning for JoinIR mainline unification before selfhost depth-2. All 4 tasks delivered detailed analysis totaling **1,698+ lines of documentation**, revealing critical insights that make Phase 182-183 implementation straightforward.
|
**Summary**: Phase 181 successfully completed comprehensive planning for JoinIR mainline unification before selfhost depth-2. All 4 tasks delivered detailed analysis totaling **1,698+ lines of documentation**, revealing critical insights that make Phase 182-183 implementation straightforward.
|
||||||
|
|
||||||
|
|||||||
@ -29,15 +29,25 @@ pub struct JoinIrTargetDesc {
|
|||||||
///
|
///
|
||||||
/// Phase 32 L-4: 全対象関数を一覧化し、Exec/LowerOnly の区分を明示する。
|
/// Phase 32 L-4: 全対象関数を一覧化し、Exec/LowerOnly の区分を明示する。
|
||||||
/// Phase 82: このテーブルが唯一の SSOT。is_loop_lowered_function() はここから参照。
|
/// Phase 82: このテーブルが唯一の SSOT。is_loop_lowered_function() はここから参照。
|
||||||
|
/// Phase 182: representative paths 対応(3 upgrades - LOOP ONLY)
|
||||||
|
///
|
||||||
|
/// **重要**: このテーブルは LOOP lowering 専用です。
|
||||||
|
/// If lowering の関数を追加すると、is_loop_lowered_function() で除外され、
|
||||||
|
/// if-lowering が機能しなくなります。If 関数は is_joinir_if_toplevel_target() で管理。
|
||||||
///
|
///
|
||||||
/// | 関数 | Kind | デフォルト有効 | 備考 |
|
/// | 関数 | Kind | デフォルト有効 | 備考 |
|
||||||
/// |-----|------|---------------|------|
|
/// |-----|------|---------------|------|
|
||||||
/// | Main.skip/1 | Exec | No | PHI canary のため env 必須 |
|
/// | Main.skip/1 | Exec | No | PHI canary のため env 必須 |
|
||||||
/// | FuncScannerBox.trim/1 | Exec | Yes | A/B 実証済み、事実上本線 |
|
/// | FuncScannerBox.trim/1 | Exec | Yes | A/B 実証済み、事実上本線 |
|
||||||
/// | FuncScannerBox.append_defs/2 | Exec | No | Phase 82 SSOT統一で追加 |
|
/// | FuncScannerBox.append_defs/2 | Exec | No | Phase 82 SSOT統一で追加 |
|
||||||
/// | Stage1UsingResolverBox.resolve_for_source/5 | LowerOnly | No | 構造検証のみ |
|
/// | Stage1UsingResolverBox.resolve_for_source/5 | Exec | Yes | Phase 182: LowerOnly→Exec 昇格 |
|
||||||
/// | StageBBodyExtractorBox.build_body_src/2 | LowerOnly | No | 構造検証のみ |
|
/// | StageBBodyExtractorBox.build_body_src/2 | Exec | Yes | Phase 182: LowerOnly→Exec 昇格 |
|
||||||
/// | StageBFuncScannerBox.scan_all_boxes/1 | LowerOnly | No | 構造検証のみ |
|
/// | StageBFuncScannerBox.scan_all_boxes/1 | Exec | Yes | Phase 182: LowerOnly→Exec 昇格 |
|
||||||
|
///
|
||||||
|
/// Phase 181/182 設計ドキュメント:
|
||||||
|
/// - docs/private/roadmap2/phases/phase-181/joinir-targets-mapping.md
|
||||||
|
/// - docs/private/roadmap2/phases/phase-181/representative-paths-finalized.md
|
||||||
|
/// - docs/private/roadmap2/phases/phase-182/FINDINGS.md (Phase 182 実装時発見事項)
|
||||||
pub const JOINIR_TARGETS: &[JoinIrTargetDesc] = &[
|
pub const JOINIR_TARGETS: &[JoinIrTargetDesc] = &[
|
||||||
// Loop Exec(実行対応)
|
// Loop Exec(実行対応)
|
||||||
JoinIrTargetDesc {
|
JoinIrTargetDesc {
|
||||||
@ -55,21 +65,21 @@ pub const JOINIR_TARGETS: &[JoinIrTargetDesc] = &[
|
|||||||
kind: JoinIrBridgeKind::Exec,
|
kind: JoinIrBridgeKind::Exec,
|
||||||
default_enabled: false,
|
default_enabled: false,
|
||||||
},
|
},
|
||||||
// Loop LowerOnly(構造検証のみ)
|
// Phase 182 昇格: Stage-1/Stage-B infrastructure (LowerOnly → Exec)
|
||||||
JoinIrTargetDesc {
|
JoinIrTargetDesc {
|
||||||
func_name: "Stage1UsingResolverBox.resolve_for_source/5",
|
func_name: "Stage1UsingResolverBox.resolve_for_source/5",
|
||||||
kind: JoinIrBridgeKind::LowerOnly,
|
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
|
||||||
default_enabled: false,
|
default_enabled: true,
|
||||||
},
|
},
|
||||||
JoinIrTargetDesc {
|
JoinIrTargetDesc {
|
||||||
func_name: "StageBBodyExtractorBox.build_body_src/2",
|
func_name: "StageBBodyExtractorBox.build_body_src/2",
|
||||||
kind: JoinIrBridgeKind::LowerOnly,
|
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
|
||||||
default_enabled: false,
|
default_enabled: true,
|
||||||
},
|
},
|
||||||
JoinIrTargetDesc {
|
JoinIrTargetDesc {
|
||||||
func_name: "StageBFuncScannerBox.scan_all_boxes/1",
|
func_name: "StageBFuncScannerBox.scan_all_boxes/1",
|
||||||
kind: JoinIrBridgeKind::LowerOnly,
|
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
|
||||||
default_enabled: false,
|
default_enabled: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user