chore: Phase 25.2関連ドキュメント更新&レガシーテストアーカイブ整理

## ドキュメント更新
- CURRENT_TASK.md: Phase 25.2完了記録
- phase-25.1b/e/q/25.2 README更新
- json_v0_bridge/README.md新規追加

## テストファイル整理
- vtable_*テストをtests/archive/に移動(6ファイル)
- json_program_loop.rsテスト追加

## コード整理
- プラグイン(egui/python-compiler)微修正
- benchmarks.rs, instance_v2.rs更新
- MIR関連ファイル微調整

## 全体成果
Phase 25.2完了により:
- LoopSnapshotMergeBox統一管理実装
- ValueId(1283)バグ根本解決
- ~35行コード削減(目標210行の16%)
- 11テスト全部PASS、3実行テストケースPASS
This commit is contained in:
nyash-codex
2025-11-20 03:56:12 +09:00
parent dbd0900da9
commit 9bdf2ff069
30 changed files with 777 additions and 283 deletions

View File

@ -1,8 +1,10 @@
/*!
* phi_core::loop_phi loop-specific PHI management (scaffold)
* phi_core::loop_phi loop-specific PHI management (legacy scaffold)
*
* Phase 1 defines minimal types only. The concrete logic remains in
* `mir::loop_builder` and will be delegated/moved here in later phases.
* - 25.1e / 25.1q / 25.2 で LoopForm v2 + LoopSnapshotMergeBox に切り替え済み。
* - 現在の Run 時間経路AST / JSON frontは `loopform_builder.rs` を SSOT としており、
* 本モジュールは互換レイヤ(歴史的な隊列や分析用)としてのみ残している。
* - Phase 31.x 以降で段階的に削除予定。新しい PHI 実装をここに追加してはいけない。
*/
use crate::mir::{BasicBlockId, ValueId};

View File

@ -66,12 +66,18 @@ pub struct PinnedVariable {
/// LoopForm Meta-Box: Structured representation of loop SSA construction
///
/// Separates loop variables into two categories:
/// - Carriers: Modified in loop body, need true PHI nodes
/// - Pinned: Loop-invariant, need PHI for exit merge only
/// Separates loop-visible variables into classes25.1e/25.2 スコープモデル):
/// - Carriers: Modified in loop body, need header/exit PHI nodes.
/// - Pinned: Loop-invariant parameters/receivers, need PHI so every header/exit
/// edge has a well-defined value but the logical value never changes.
/// - Invariants: Not tracked here; they keep the preheader ValueId and never
/// participate in PHI construction.
/// - Body-local live-out (BodyLocalInOut): Not stored as dedicated structs, but
/// detected at exit-phi time in `build_exit_phis` and merged via
/// `LoopSnapshotMergeBox::merge_exit`.
///
/// Key Innovation: All ValueIds allocated upfront before any MIR emission,
/// eliminating circular dependency issues.
/// Key idea: All ValueIds for Carriers/Pinned are allocated upfront before any
/// MIR emission, eliminating circular dependency issues in SSA.
#[derive(Debug)]
pub struct LoopFormBuilder {
pub carriers: Vec<CarrierVariable>,