feat(joinir): Phase 184 If lowering mainline & JOINIR_IF_TARGETS
Establish If lowering infrastructure with dedicated JOINIR_IF_TARGETS table, separate from loop lowering (JOINIR_TARGETS). Implementation: - Add JOINIR_IF_TARGETS table with 6 representative functions - Add is_if_lowered_function() for table-based lookup - Update is_if_mainline_target() to use table (SSOT) - Update is_joinir_if_toplevel_target() with table-first lookup - Export via join_ir_vm_bridge_dispatch public API Representative functions: - IfSelectTest.test/1 (simple return pattern) - IfSelectLocalTest.main/0 (local variable pattern) - IfMergeTest.simple_true/0, simple_false/0 (multiple variables) - JsonShapeToMap._read_value_from_pair/1 (Stage-1 production) - Stage1JsonScannerBox.value_start_after_key_pos/2 (Stage-B production) Architecture: Loop/If separation complete (1関数につき1 lowering) Verification: All representative paths pass with NYASH_JOINIR_DEBUG=1 Phase 184 complete → Phase 185+ ready 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -94,12 +94,14 @@ pub fn is_loop_mainline_target(name: &str) -> bool {
|
||||
is_loop_lowered_function(name)
|
||||
}
|
||||
|
||||
/// Phase 80: JoinIR 本線化対象(If)の判定
|
||||
/// Phase 80/184: JoinIR 本線化対象(If)の判定
|
||||
///
|
||||
/// `joinir_core_enabled()=true` の時、これらの関数の if/else は
|
||||
/// 必ず JoinIR → MIR 経路を本線として試行します。
|
||||
///
|
||||
/// Phase 184: JOINIR_IF_TARGETS テーブルからの参照に変更
|
||||
pub fn is_if_mainline_target(name: &str) -> bool {
|
||||
is_joinir_if_toplevel_target(name)
|
||||
crate::mir::join_ir_vm_bridge_dispatch::is_if_lowered_function(name)
|
||||
}
|
||||
|
||||
/// Phase 80: Core ON 時に JoinIR を本線として試行すべきか判定
|
||||
@ -126,21 +128,33 @@ pub fn should_panic_on_joinir_failure(func_name: &str, is_loop: bool) -> bool {
|
||||
should_try_joinir_mainline(func_name, is_loop)
|
||||
}
|
||||
|
||||
/// Phase 61-4: ループ外 If の JoinIR 対象関数判定
|
||||
/// Phase 61-4/184: ループ外 If の JoinIR 対象関数判定
|
||||
///
|
||||
/// HAKO_JOINIR_IF_TOPLEVEL=1 有効時に、ループ外 if の JoinIR 経路を試行する関数。
|
||||
/// 段階的に対象を拡大するため、最小限のホワイトリストから開始。
|
||||
/// Phase 184: JOINIR_IF_TARGETS テーブルに統一(SSOT化)
|
||||
///
|
||||
/// ## 対象関数
|
||||
/// ## 対象関数(テーブル管理)
|
||||
/// - IfSelectTest.*: テスト専用関数群
|
||||
/// - IfMergeTest.*: 複数変数テスト(Phase 33-7)
|
||||
/// - IfToplevelTest.*: ループ外 if テスト専用(Phase 61-4)
|
||||
/// - JsonShapeToMap._read_value_from_pair/1: Phase 33-4 で検証済み
|
||||
/// - JsonShapeToMap._read_value_from_pair/1: Phase 33-4 Stage-1 実用関数
|
||||
/// - Stage1JsonScannerBox.value_start_after_key_pos/2: Phase 33-4 Stage-B 実用関数
|
||||
///
|
||||
/// ## 使用方法
|
||||
/// if_form.rs から呼び出され、関数名がホワイトリストに含まれる場合のみ
|
||||
/// if_form.rs から呼び出され、関数名がテーブルに含まれる場合のみ
|
||||
/// JoinIR 経路を試行する。
|
||||
///
|
||||
/// Phase 184: テーブル参照に変更(プレフィックス判定は併用)
|
||||
pub fn is_joinir_if_toplevel_target(name: &str) -> bool {
|
||||
// Test prefixes (always enabled)
|
||||
// Phase 184: JOINIR_IF_TARGETS テーブルから参照(exact match)
|
||||
if crate::mir::join_ir_vm_bridge_dispatch::JOINIR_IF_TARGETS
|
||||
.iter()
|
||||
.any(|t| t.func_name == name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Test prefixes (backward compatibility - allows any test function)
|
||||
if name.starts_with("IfSelectTest.")
|
||||
|| name.starts_with("IfToplevelTest.")
|
||||
|| name.starts_with("IfMergeTest.")
|
||||
@ -148,12 +162,7 @@ pub fn is_joinir_if_toplevel_target(name: &str) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Explicit approvals (Phase 33-4 verified)
|
||||
matches!(
|
||||
name,
|
||||
"JsonShapeToMap._read_value_from_pair/1"
|
||||
| "Stage1JsonScannerBox.value_start_after_key_pos/2"
|
||||
)
|
||||
false
|
||||
}
|
||||
|
||||
/// Phase 33-7: Try to lower if/else to JoinIR Select/IfMerge instruction
|
||||
|
||||
Reference in New Issue
Block a user