diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index 23076725..f7eebf12 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -21,6 +21,9 @@ Scope: Repo root の旧リンク互換。現行の入口は `docs/development/cu **Next implementation (CorePlan Step-A)** `docs/development/current/main/phases/phase-29am/P0-COREPLAN-LOWERER-IF-EXIT-INSTRUCTIONS.md` +**2025-12-29: Phase 29am P0 COMPLETE (CorePlan If/Exit lowerer/verifier)** +CorePlan の If/Exit を lowerer/verifier で扱えるようにして、CorePlan 移行の土台を作った。 + **PlanRuleOrder SSOT** single_planner の順序/名前 SSOT は `src/mir/builder/control_flow/plan/single_planner/rule_order.rs` に固定。PlannerContext で Pattern1 facts の抑制を開始し、残りの guard/filter は段階移行。 diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index cd958db1..d87c750c 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -2,11 +2,16 @@ ## Current Focus: Phase 29am(CorePlan Step-A implementation) -Next: Phase 29am P0(CorePlan::If/CorePlan::Exit lowerer/verifier) +Next: Phase 29am P1(Loop body Seq flatten) 運用ルール: integration filter で phase143_* は回さない(JoinIR 回帰は phase29ae pack のみ) 運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う 移行道筋 SSOT: `docs/development/current/main/design/coreplan-migration-roadmap-ssot.md` +**2025-12-29: Phase 29am P0 完了** ✅ +- 目的: CorePlan の If/Exit を lowerer/verifier で扱えるようにして、CorePlan 移行の土台を作る(仕様不変) +- 変更: `src/mir/builder/control_flow/plan/lowerer.rs` / `src/mir/builder/control_flow/plan/verifier.rs` +- 検証: `cargo build --release` / `./tools/smokes/v2/run.sh --profile quick` / `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` + **2025-12-29: Phase 29al P3 完了** ✅ - 目的: cleanup を ExitKind と effect の契約として固定(仕様不変) - SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md` diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index 296fcda0..8ac03d4a 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -37,7 +37,8 @@ Related: - **Phase 29am(candidate): CorePlan Step-A implementation (lowerer/verifier)** - 入口: `docs/development/current/main/phases/phase-29am/README.md` - - Next: P0(CorePlan::If/CorePlan::Exit lowerer/verifier) + - 状況: P0 ✅ 完了 + - Next: P1(Loop body Seq flatten) - Gate: `./tools/smokes/v2/profiles/integration/joinir/phase29ae_regression_pack_vm.sh` - **Phase 29ai(candidate): Plan/Frag single-planner(Facts SSOT)** diff --git a/docs/development/current/main/phases/phase-29am/P1-CORELOOP-BODY-SEQ-FLATTEN-INSTRUCTIONS.md b/docs/development/current/main/phases/phase-29am/P1-CORELOOP-BODY-SEQ-FLATTEN-INSTRUCTIONS.md new file mode 100644 index 00000000..7a587818 --- /dev/null +++ b/docs/development/current/main/phases/phase-29am/P1-CORELOOP-BODY-SEQ-FLATTEN-INSTRUCTIONS.md @@ -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"` + diff --git a/docs/development/current/main/phases/phase-29am/README.md b/docs/development/current/main/phases/phase-29am/README.md index 63bc7599..1b5896ca 100644 --- a/docs/development/current/main/phases/phase-29am/README.md +++ b/docs/development/current/main/phases/phase-29am/README.md @@ -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 側の語彙で表現する)