docs(phase29am): mark p0 done; add p1 seq flatten instructions

This commit is contained in:
2025-12-29 16:49:05 +09:00
parent 2dbc4b5968
commit 3c76d8eabf
5 changed files with 77 additions and 2 deletions

View File

@ -0,0 +1,61 @@
---
Status: Active
Scope: code仕様不変、CorePlan互換性の拡張
Related:
- docs/development/current/main/phases/phase-29am/README.md
- docs/development/current/main/design/coreplan-migration-roadmap-ssot.md
- docs/development/current/main/design/post-phi-final-form-ssot.md
---
# Phase 29am P1: CoreLoopPlan body supports Seq-of-effects (flatten)
Date: 2025-12-29
Status: Ready for execution
Scope: `CoreLoopPlan.body` の “Effect-only” 制約を維持したまま、`Seq([Effect...])` を flatten して emit できるようにする
## Why
現状:
- `lower_loop_generalized()``loop_plan.body``CorePlan::Effect` しか許可していない
- しかし Normalizer/Composer の合成都合で `Seq([Effect...])` が自然に出る(将来の Skeleton+Feature 合成で顕在化しやすい)
ここを先に受理しておくと、CorePlan 合成の自由度が上がる一方で、CFG/Frag を壊さないbranch/exit は body_bb では扱わない)。
## Non-goals
- `CorePlan::If``loop_plan.body` に入れるbranch は Frag が SSOT
- `CorePlan::Exit``loop_plan.body` に入れるexit は ExitMap/Frag が SSOT
- 既存のルーティング/観測/エラー文字列の変更
## Implementation
### Step 1: lowerer で Seq-of-effects を flatten
Target:
- `src/mir/builder/control_flow/plan/lowerer.rs`
Change:
- `lower_loop_generalized()` の body_bb special handling を拡張する
- 許可する形:
- `CorePlan::Effect(_)`
- `CorePlan::Seq([CorePlan::Effect(_), ...])`(入れ子 Seq は再帰 flatten
- それ以外If/Exit/Loopは従来通り error挙動不変
### Step 2: unit tests
Target:
- `src/mir/builder/control_flow/plan/lowerer.rs` の tests
Add:
- `CoreLoopPlan.body``Seq([Effect...])` を入れて PASS
## Verification
- `cargo build --release`
- `./tools/smokes/v2/run.sh --profile quick`
- `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
## Commit
- `git add -A && git commit -m "phase29am(p1): flatten seq-of-effects in core loop body"`

View File

@ -20,3 +20,8 @@ SSOT 道筋: `docs/development/current/main/design/coreplan-migration-roadmap-ss
- ねらい: 既存のルーティング/観測を変えずに、CorePlan 側の “未対応エラー” を減らす(仕様不変)
- Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh`
## P1: Allow Seq-of-effects in CoreLoopPlan body (flatten)
- 指示書: `docs/development/current/main/phases/phase-29am/P1-CORELOOP-BODY-SEQ-FLATTEN-INSTRUCTIONS.md`
- ねらい: ループ body_bb では “Effect だけ” を前提にしつつ、`Seq([Effect...])` を安全に flatten して emit できるようにする
- 非目的: `If/Exit` を body_bb に入れる(これは Frag/ExitMap 側の語彙で表現する)