docs: Phase 267 P0 EdgeCFG Branch (BranchStub + emit_frag)
This commit is contained in:
@ -1,5 +1,18 @@
|
||||
# Self Current Task — Now (main)
|
||||
|
||||
## 2025-12-21:Phase 267 P0(BranchStub + emit_frag)✅
|
||||
|
||||
**目的**: Frag に Branch を第一級で追加し、wires(Jump/Return)と同様に MIR terminator へ落とせる入口(SSOT)を作る
|
||||
**結果**: `emit_frag()` により、`wires + branches` を BasicBlockId 層で PoC 証明(unit tests)まで完了
|
||||
|
||||
- ✅ `BranchStub` 追加 + `Frag.branches` 追加
|
||||
- ✅ `compose::if_` が header→then/else の `BranchStub` を生成
|
||||
- ✅ `emit_frag(function, frag)` 追加(`verify_frag_invariants_strict` を先頭で実行、1 block = 1 terminator を Fail-Fast)
|
||||
- ✅ `cargo test -p nyash-rust --lib` PASS
|
||||
|
||||
**注意(P1)**: NormalizedShadow/JoinIR への実適用は層ミスマッチがあるため Phase 268 に繰り越し
|
||||
**詳細**: `docs/development/current/main/phases/phase-267/README.md`
|
||||
|
||||
## 2025-12-21:Phase 266(wires → MIR terminator 生成 - 最小 PoC)✅
|
||||
|
||||
**目的**: wires を MIR terminator に変換する最小 PoC を実装し、Phase 267 での本格適用に備える
|
||||
|
||||
@ -145,6 +145,18 @@ Related:
|
||||
- verify strict 版で段階導入を壊さない
|
||||
- **次**: Phase 267 で JoinIR Pattern への適用
|
||||
|
||||
- **(✅ P0 完了)Phase 267: BranchStub + emit_frag(Branch の第一級化)**
|
||||
- **目的**: Frag に Branch を第一級で追加し、wires(Jump/Return)と同様に MIR terminator へ落とす入口を作る
|
||||
- **完了内容(P0)**:
|
||||
- `BranchStub` 追加 + `Frag.branches` 追加
|
||||
- `compose::if_` が header→then/else の BranchStub を生成
|
||||
- `emit_frag(function, frag)` を追加(`emit_wires` + `set_branch_with_edge_args`)
|
||||
- 1 block = 1 terminator(wire/branch の衝突)を Fail-Fast
|
||||
- unit tests + `cargo test -p nyash-rust --lib` PASS
|
||||
- **P1(延期)**:
|
||||
- “層を跨がない実適用”は候補が抽象化層へ委譲済みのため、Phase 268 で体系的に適用する方針
|
||||
- **詳細**: `docs/development/current/main/phases/phase-267/README.md`
|
||||
|
||||
- **real-app loop regression の横展開(VM + LLVM EXE)**
|
||||
- ねらい: 実コード由来ループを 1 本ずつ最小抽出して fixture/smoke で固定する(段階投入)。
|
||||
- 現状: Phase 107(find_balanced_array/object / json_cur 由来)まで固定済み。
|
||||
|
||||
@ -261,6 +261,19 @@ Phase 267: Pattern6/7/8 への展開
|
||||
|
||||
**次フェーズへの橋渡し**:
|
||||
|
||||
## Phase 267(P0完了): Branch の第一級化(BranchStub + emit_frag)
|
||||
|
||||
- 目的: Frag に Branch を第一級で追加し、wires(Jump/Return)と同様に MIR terminator へ落とす入口を作る。
|
||||
- 追加:
|
||||
- `BranchStub`(header→then/else の分岐を表現)
|
||||
- `Frag.branches: Vec<BranchStub>`(Branch 専用、wires と分離)
|
||||
- `emit_frag(function, frag)`(SSOT: `emit_wires` + `set_branch_with_edge_args`、1 block=1 terminator を Fail-Fast)
|
||||
- スコープ:
|
||||
- ✅ BasicBlockId 層で unit test により PoC 証明
|
||||
- ❌ NormalizedShadow/JoinIR への実適用は Phase 268 に繰り越し(層境界維持)
|
||||
|
||||
詳細: `docs/development/current/main/phases/phase-267/README.md`
|
||||
|
||||
Phase 267: JoinIR Pattern への適用
|
||||
- NormalizedShadow への Frag 適用
|
||||
- Pattern6/7/8 を Frag 化
|
||||
|
||||
34
docs/development/current/main/phases/phase-267/README.md
Normal file
34
docs/development/current/main/phases/phase-267/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Phase 267 — EdgeCFG Branch(BranchStub + emit_frag)
|
||||
|
||||
Status: Completed (P0) ✅ / P1 deferred ⏸️
|
||||
SSOT (design): `docs/development/current/main/design/edgecfg-fragments.md`
|
||||
|
||||
## ゴール
|
||||
- `Frag` に **Branch(条件分岐)**を第一級で追加し、`wires`(Jump/Return)と同様に **MIR terminator へ落とせる**入口を作る
|
||||
- 既存の JoinIR/NormalizedShadow/Pattern6/7/8 は触らず、**BasicBlockId 層の test-only PoC**で証明する
|
||||
|
||||
## P0(完了)
|
||||
### 実装
|
||||
- `BranchStub` を追加(フラット構造: from/cond/then/else + edge-args)
|
||||
- `src/mir/builder/control_flow/edgecfg/api/branch_stub.rs`
|
||||
- `Frag` に `branches: Vec<BranchStub>` を追加(Branch 専用)
|
||||
- `wires` は Jump/Return 専用のまま維持
|
||||
- `src/mir/builder/control_flow/edgecfg/api/frag.rs`
|
||||
- `compose::if_` が header→then/else の `BranchStub` を生成するように更新
|
||||
- `src/mir/builder/control_flow/edgecfg/api/compose.rs`
|
||||
- `emit_frag(function, frag)` を追加(SSOT)
|
||||
- `verify_frag_invariants_strict()` を最初に実行
|
||||
- `wires` は `emit_wires()` を内部利用
|
||||
- `branches` は `set_branch_with_edge_args()` で terminator + successors を同期
|
||||
- 1 block = 1 terminator(wire/branch 重複)を Fail-Fast
|
||||
- `src/mir/builder/control_flow/edgecfg/api/emit.rs`
|
||||
|
||||
### テスト
|
||||
- `emit_frag` の Branch 生成・衝突検出、`compose::if_` の BranchStub 生成を unit test で固定(lib tests PASS)
|
||||
|
||||
## P1(見送り)
|
||||
- “層を跨がない実適用”の候補調査を行い、現状は抽象化層(emit_conditional/emit_jump 等)へ委譲済みであるため、無理に差し替えず **Phase 268** で体系的に適用する方針
|
||||
|
||||
## 次フェーズ(Phase 268)
|
||||
- Branch の edge-args(then/else entry params)計算を含めた実戦投入
|
||||
- JoinIR/NormalizedShadow/Pattern6/7/8 側へ段階的に適用(層境界を守る)
|
||||
Reference in New Issue
Block a user