feat(phase40-3): dev flag実装 + テストインフラ準備

Phase 40-3成果:
- dev flag追加: use_joinir_for_array_filter() (env.rs)
- テストドキュメント更新 (phase40_array_ext_filter_test.rs)

フルパイプライン統合はPhase 40-3.5+に延期

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-28 10:34:50 +09:00
parent aa0b3972b9
commit 29058d2c9a
3 changed files with 44 additions and 29 deletions

View File

@ -1,12 +1,16 @@
//! Phase 40-1 Integration Test: JoinIR Meta Path
//! Phase 40-3 Integration Test: array_ext.filter A/B Test
//!
//! ## Purpose
//! JoinFuncMeta経由でif-in-loop修正変数を検出し
//! MIR変換パスにメタデータを渡せることを検証。
//! array_ext.filterのif-in-loop PHI生成について
//! Route A (legacy AST→MIR) と Route B (JoinIR Frontend) を比較検証。
//!
//! ## Note
//! Phase 40-1ではPHI生成は未実装ログ出力のみ
//! 実際のPHI生成はPhase 40-2以降で実装予定。
//! ## Routes
//! - Route A: 旧AST→MIR + collect_assigned_vars経路 (HAKO_JOINIR_ARRAY_FILTER=0)
//! - Route B: JoinIR Frontend + JoinFuncMeta経路 (HAKO_JOINIR_ARRAY_FILTER=1)
//!
//! ## Success Criteria
//! - 実行結果が完全一致([2, 4, 6]
//! - 5回連続PASS
#![allow(dead_code)]
@ -115,7 +119,28 @@ fn phase40_mir_conversion_with_meta() {
}
// ========================================
// Phase 40-1 Status
// Phase 40-3: A/B Test (Conceptual)
// ========================================
//
// ## Note
// フルパイプライン統合は非常に複雑なため、Phase 40-3では以下を実装
// 1. ✅ Dev flag (HAKO_JOINIR_ARRAY_FILTER)
// 2. ✅ Public API (lower_loop_with_if_meta, extract_if_in_loop_modified_vars)
// 3. ✅ Test infrastructure
// 4. 📋 実装計画ドキュメントREADME更新
//
// ## 実際のA/Bテストは将来実装
// フルパイプライン統合AST→JoinIR vs AST→MIR分岐は、
// より大きなリファクタリングが必要。Phase 40-3では基盤準備まで。
//
// ## Phase 40-3完了条件
// - [x] Dev flag実装
// - [x] API存在確認既存実装を活用
// - [x] ドキュメント更新
// - [ ] 将来のフルA/Bテスト実装計画策定README.md
// ========================================
// Phase 40-1 Status (継続)
// ========================================
//
// ✅ Step 1: func_meta.rs 作成完了Phase 40-1.1
@ -125,20 +150,6 @@ fn phase40_mir_conversion_with_meta() {
// ✅ Step 5: Integration test 作成完了Phase 40-1.2
// ✅ Step 6: collect_assigned_vars削除判定完了削除不可確認
//
// ## Phase 40-1.2/1.3 Implementation Complete
//
// Phase 40-1 implementations:
// 1. ✅ JoinFuncMeta metadata passing infrastructure
// 2. ✅ if_modified_vars detection and propagation
// 3. ✅ MIR conversion without errors
// 4. ✅ Unit tests for helper methods
// 5. ✅ Integration tests for MIR conversion path
//
// Phase 40-2以降で実装予定:
// - 実際のloop exit PHI生成
// - exit block特定ロジック
// - PHI incoming value計算
//
// ## collect_assigned_vars削除判定結果
//
// callsites: loop_builder.rs:1069, 1075
@ -146,13 +157,7 @@ fn phase40_mir_conversion_with_meta() {
// - **削除不可**: 旧パスで依然必要
// - **Phase 40-1では削除しない**
//
// 理由:
// - JoinIRパスは実験的パス新規開発中
// - 旧AST→MIRパスは本番パス現行システム
// - 両パスは完全に独立JoinIRは旧パスを置換しない
// - collect_assigned_vars()は旧パスで必須if-in-loop PHI生成に使用中
//
// 削除可能になる条件Phase 40-2以降:
// 削除可能になる条件Phase 40-4以降:
// - JoinIRパスが旧パスを完全置換
// - loop_builder.rsの該当コードパスが削除される
// - または旧パス全体がJoinIRパスに統合される