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:
nyash-codex
2025-12-04 21:03:44 +09:00
parent 19c87263f5
commit 78e8eca971
2 changed files with 73 additions and 11 deletions

View File

@ -29,15 +29,25 @@ pub struct JoinIrTargetDesc {
///
/// Phase 32 L-4: 全対象関数を一覧化し、Exec/LowerOnly の区分を明示する。
/// 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 | デフォルト有効 | 備考 |
/// |-----|------|---------------|------|
/// | Main.skip/1 | Exec | No | PHI canary のため env 必須 |
/// | FuncScannerBox.trim/1 | Exec | Yes | A/B 実証済み、事実上本線 |
/// | FuncScannerBox.append_defs/2 | Exec | No | Phase 82 SSOT統一で追加 |
/// | Stage1UsingResolverBox.resolve_for_source/5 | LowerOnly | No | 構造検証のみ |
/// | StageBBodyExtractorBox.build_body_src/2 | LowerOnly | No | 構造検証のみ |
/// | StageBFuncScannerBox.scan_all_boxes/1 | LowerOnly | No | 構造検証のみ |
/// | Stage1UsingResolverBox.resolve_for_source/5 | Exec | Yes | Phase 182: LowerOnly→Exec 昇格 |
/// | StageBBodyExtractorBox.build_body_src/2 | Exec | Yes | Phase 182: LowerOnly→Exec 昇格 |
/// | 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] = &[
// Loop Exec実行対応
JoinIrTargetDesc {
@ -55,21 +65,21 @@ pub const JOINIR_TARGETS: &[JoinIrTargetDesc] = &[
kind: JoinIrBridgeKind::Exec,
default_enabled: false,
},
// Loop LowerOnly(構造検証のみ)
// Phase 182 昇格: Stage-1/Stage-B infrastructure (LowerOnly → Exec)
JoinIrTargetDesc {
func_name: "Stage1UsingResolverBox.resolve_for_source/5",
kind: JoinIrBridgeKind::LowerOnly,
default_enabled: false,
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
default_enabled: true,
},
JoinIrTargetDesc {
func_name: "StageBBodyExtractorBox.build_body_src/2",
kind: JoinIrBridgeKind::LowerOnly,
default_enabled: false,
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
default_enabled: true,
},
JoinIrTargetDesc {
func_name: "StageBFuncScannerBox.scan_all_boxes/1",
kind: JoinIrBridgeKind::LowerOnly,
default_enabled: false,
kind: JoinIrBridgeKind::Exec, // Phase 182: LowerOnly から昇格
default_enabled: true,
},
];