docs(phase29al): exitkind cleanup effect contract ssot
This commit is contained in:
@ -2,10 +2,14 @@
|
||||
|
||||
## Current Focus: Phase 29al(CorePlan composition hardening / docs-first)
|
||||
|
||||
Next: Phase 29al P3(ExitKind/cleanup と effect の接続: design only)
|
||||
Next: Phase 29al P4(unwind を含む ExitKind 拡張: design only)
|
||||
運用ルール: integration filter で phase143_* は回さない(JoinIR 回帰は phase29ae pack のみ)
|
||||
運用ルール: phase286_pattern9_* は legacy pack (SKIP) を使う
|
||||
|
||||
**2025-12-29: Phase 29al P3 完了** ✅
|
||||
- 目的: cleanup を ExitKind と effect の契約として固定(仕様不変)
|
||||
- SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md`
|
||||
|
||||
**2025-12-29: Phase 29al P2 完了** ✅
|
||||
- 目的: effect 分類と “許される変形” の最小法典を SSOT 化(仕様不変)
|
||||
- SSOT: `docs/development/current/main/design/effect-classification-ssot.md`
|
||||
|
||||
@ -31,8 +31,8 @@ Related:
|
||||
|
||||
- **Phase 29al(candidate): CorePlan composition hardening (docs-first)**
|
||||
- 入口: `docs/development/current/main/phases/phase-29al/README.md`
|
||||
- 状況: P0/P1/P2 ✅ 完了(docs-only)
|
||||
- Next: P3(ExitKind/cleanup と effect の接続: design only)
|
||||
- 状況: P0/P1/P2/P3 ✅ 完了(docs-only)
|
||||
- Next: P4(unwind を含む ExitKind 拡張: design only)
|
||||
|
||||
- **Phase 29ai(candidate): Plan/Frag single-planner(Facts SSOT)**
|
||||
- 入口: `docs/development/current/main/phases/phase-29ai/README.md`
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
---
|
||||
Status: SSOT
|
||||
Scope: ExitKind / cleanup / effect の契約(JoinIR/PlanFrag/MIR で意味論を壊さない)
|
||||
Related:
|
||||
- docs/development/current/main/design/effect-classification-ssot.md
|
||||
- docs/development/current/main/design/post-phi-final-form-ssot.md
|
||||
- docs/development/current/main/design/joinir-plan-frag-ssot.md
|
||||
- docs/development/current/main/phases/phase-29aa/README.md
|
||||
---
|
||||
|
||||
# ExitKind / Cleanup / Effect Contract (SSOT)
|
||||
|
||||
目的: return/break/continue(将来 unwind を含む)に付随する cleanup(RC release 等)が、最適化や再順序で壊れないように、
|
||||
**ExitKind と effect の契約**として固定する。
|
||||
|
||||
この SSOT は「新しいcleanup機能を追加する」ためではなく、既存の意味論を守るための境界を明文化する。
|
||||
|
||||
## 1. 用語
|
||||
|
||||
- ExitKind: 関数/ループからの脱出種別(Return/Break/Continue/将来 Unwind)
|
||||
- Cleanup: Exit を跨いで走る必要がある処理(例: ReleaseStrong の注入、defer/finally 等)
|
||||
- Effect: 命令の副作用分類(Pure/Mut/Io/Control)
|
||||
|
||||
## 2. SSOT: Cleanup は ExitKind の語彙に属する
|
||||
|
||||
cleanup は “パターン個別の都合” で散らさない。
|
||||
必ず ExitKind の語彙として扱い、PlanFrag/CorePlan/merge で責務境界を固定する。
|
||||
|
||||
参照:
|
||||
- Phase 29aa(RC insertion の安全拡張): `docs/development/current/main/phases/phase-29aa/README.md`
|
||||
- Plan/Frag SSOT: `docs/development/current/main/design/joinir-plan-frag-ssot.md`
|
||||
|
||||
## 3. Invariants(最小)
|
||||
|
||||
### I1: Cleanup 命令は `Mut`(非Pure)として扱う
|
||||
|
||||
例:
|
||||
- `ReleaseStrong` / `RetainStrong` は `Mut`(少なくとも DCE/CSE の対象外になる)
|
||||
|
||||
理由:
|
||||
- DCE/CSE が cleanup を消したりまとめたりすると意味論が壊れる。
|
||||
|
||||
### I2: Cleanup は Exit の直前/直後の “境界点” にのみ置く
|
||||
|
||||
“途中のブロック” に cleanup をばら撒くと、再順序/最適化の影響が広がる。
|
||||
cleanup の挿入点は SSOT として固定する(例: Return terminator の直前)。
|
||||
|
||||
現状の例(RC insertion 系):
|
||||
- Return ブロックの BeforeTerminator のみ(Jump/Branch では入れない、などの安全条件)
|
||||
|
||||
### I3: Control(Exit/terminator)を跨いで cleanup を移動しない
|
||||
|
||||
- `Control` を跨ぐ移動は禁止(exit の前後関係が崩れる)
|
||||
- `Io` を跨ぐ移動も禁止(外部観測が変わる)
|
||||
|
||||
### I4: Join(post-phi)と cleanup は “順序SSOT” を共有する
|
||||
|
||||
join 入力(carrier layout)と cleanup の対象(carrier/locals)は同じ順序SSOTを参照し、実装ごとに順序が揺れない。
|
||||
|
||||
参照:
|
||||
- `docs/development/current/main/design/post-phi-final-form-ssot.md`
|
||||
|
||||
## 4. Freeze / Fail-Fast の方針(最小)
|
||||
|
||||
- cleanup が “安全条件外” に計画された場合は strict/dev で Fail-Fast(Freeze または debug_assert)
|
||||
- release 既定では挙動を変えない(安全側に倒す)
|
||||
|
||||
## 5. Next(将来の拡張点)
|
||||
|
||||
- `ExitKind::Unwind` の設計(cleanup/defer/finally を ExitKind 経由で統一)
|
||||
- effect と “panic/throw” の扱い(Pure/Io/Control 境界)
|
||||
|
||||
@ -29,3 +29,4 @@ Scope: JoinIR plan/frag 導線(仕様不変)
|
||||
- CorePlan Skeleton/Feature model: `docs/development/current/main/design/coreplan-skeleton-feature-model.md`
|
||||
- Post-PHI final form SSOT: `docs/development/current/main/design/post-phi-final-form-ssot.md`
|
||||
- Effect classification SSOT: `docs/development/current/main/design/effect-classification-ssot.md`
|
||||
- ExitKind/Cleanup/Effect contract SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md`
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
---
|
||||
Status: Active
|
||||
Scope: docs-first(仕様不変)
|
||||
Related:
|
||||
- docs/development/current/main/phases/phase-29al/README.md
|
||||
- docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md
|
||||
- docs/development/current/main/design/effect-classification-ssot.md
|
||||
- docs/development/current/main/design/post-phi-final-form-ssot.md
|
||||
---
|
||||
|
||||
# Phase 29al P3: ExitKind/Cleanup/Effect contract SSOT(docs-first)
|
||||
|
||||
Date: 2025-12-29
|
||||
Status: Ready for execution
|
||||
Scope: cleanup を ExitKind と effect の契約として固定する(仕様不変)
|
||||
|
||||
## Objective
|
||||
|
||||
- cleanup(RC release 等)が、最適化/再順序で壊れないための **最小契約**を SSOT 化する
|
||||
- “pattern個別cleanup” の増殖を防ぎ、ExitKind の語彙へ収束させる
|
||||
|
||||
## Non-goals
|
||||
|
||||
- 新しい cleanup 機能追加
|
||||
- RC insertion の仕様拡張(実装変更)
|
||||
- 新 env var / 恒常ログ追加
|
||||
|
||||
## Deliverables
|
||||
|
||||
- SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md`
|
||||
- 参照導線:
|
||||
- `docs/development/current/main/design/planfrag-ssot-registry.md`
|
||||
- `docs/development/current/main/design/joinir-plan-frag-ssot.md`(必要なら)
|
||||
|
||||
## Acceptance
|
||||
|
||||
- docs-only(コード変更なし)
|
||||
- “cleanup は ExitKind 語彙” と “cleanup=Mut/Control跨ぎ禁止” が明文化されている
|
||||
|
||||
## Commit
|
||||
|
||||
- `git add -A && git commit -m "docs(phase29al): exitkind cleanup effect contract ssot"`
|
||||
|
||||
@ -30,6 +30,12 @@ Goal: “pattern が重なる/増殖する” を設計で根治し、JoinIR/Pla
|
||||
- 指示書: `docs/development/current/main/phases/phase-29al/P2-EFFECT-CLASSIFICATION-SSOT-INSTRUCTIONS.md`
|
||||
- SSOT: `docs/development/current/main/design/effect-classification-ssot.md`
|
||||
|
||||
## P3: ExitKind/Cleanup/Effect contract SSOT(docs-first)
|
||||
|
||||
- ねらい: cleanup を ExitKind と effect の契約として固定し、Control/Io を跨いだ移動や DCE 消去の事故を防ぐ
|
||||
- 指示書: `docs/development/current/main/phases/phase-29al/P3-EXITKIND-CLEANUP-EFFECT-CONTRACT-INSTRUCTIONS.md`
|
||||
- SSOT: `docs/development/current/main/design/exitkind-cleanup-effect-contract-ssot.md`
|
||||
|
||||
## Next (planned)
|
||||
|
||||
### P3: ExitKind/cleanup と effect の接続(design only)
|
||||
|
||||
Reference in New Issue
Block a user