From fbd9c83b6285ad2280b9f231174daa35522e8c36 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Fri, 26 Dec 2025 14:17:19 +0900 Subject: [PATCH] docs: reflect Phase 285 P2.2 completion (KeepAlive/ReleaseStrong) --- docs/development/current/main/10-Now.md | 24 ++++++++++------- docs/development/current/main/30-Backlog.md | 17 +++++++----- .../current/main/phases/phase-285/README.md | 27 ++++++++++++++++++- 3 files changed, 52 insertions(+), 16 deletions(-) diff --git a/docs/development/current/main/10-Now.md b/docs/development/current/main/10-Now.md index 96e30242..15ad1585 100644 --- a/docs/development/current/main/10-Now.md +++ b/docs/development/current/main/10-Now.md @@ -1,15 +1,22 @@ # Self Current Task — Now (main) -## Current Focus: Phase 285 P2.1(Hidden Root Investigation)/ Phase 287 計画 +## Current Focus: Phase 29y(post self-host, docs-first)/ Phase 285(lifecycle follow-ups) -Phase 285 P2 完了。weak 成功パターンを smoke 固定、失敗パターンは hidden root 問題で SKIP。次は P2.1(investigation)または Phase 287(Normalizer Hygiene)。 +Phase 285 は weak conformance を固めて hidden root まで根治済み。次は post self-host の Phase 29y(MIR lifecycle vocab freeze相談)を docs-first で進めつつ、Phase 285 の残差分(finalizer/GC/LLVM parity)を小刻みに潰す。 **2025-12-26: Phase 285 P2 完了** ✅ - weak の意味論(`weak ` + `weak_to_strong()` 成功)を integration smoke で固定 - Fixture A(成功パターン): exit 2 で明確化、VM/LLVM PASS -- Fixture B(失敗パターン): 明示 drop (`x = null`) 方式、hidden root 問題で SKIP +- Fixture B(失敗パターン): 明示 drop (`x = null`) 方式 - Block scope drop conformance は別タスク(P2 では扱わない) -- P2.1(investigation)提案: hidden root の原因特定 +- quick smoke 154/154 PASS 維持 + +**2025-12-26: Phase 285 P2.1 完了** ✅ +- hidden root を根治し、weak-fail fixture を PASS に復帰(`x = null` 後に `weak_to_strong()` が `null`) +- `KeepAlive(drop_after)` により「スコープ維持 / 上書きdrop」を両立(当日中に命令分離で整理) + +**2025-12-26: Phase 285 P2.2(hygiene)完了** ✅ +- `KeepAlive { values, drop_after }` を廃止し、`KeepAlive` / `ReleaseStrong` に命令分離(意図を MIR 語彙で明確化) - quick smoke 154/154 PASS 維持 **2025-12-26: Phase 285 P0 完了** ✅ @@ -41,12 +48,11 @@ Phase 285 P2 完了。weak 成功パターンを smoke 固定、失敗パター - quick smoke 154/154 PASS 維持、Pattern1/4 PoC 両方 PASS **次のステップ**: -1. **Phase 285 P0(docs-only)**: lifecycle/weak/finalization/GC の SSOT 固定 - - 手順書: `docs/development/current/main/phases/phase-285/P0-INSTRUCTIONS.md` -2. **future design(separate phase)**: Plan 生成の正規化をどう進めるか(相談パケット) +1. **Phase 287(optional)**: Hygiene(破壊的変更なし、既定挙動不変) +2. (post self-host / docs-first)**Phase 29y**: MIR lifecycle vocab freeze(RC/weak/ABI) + - 相談パケット: `docs/development/current/main/investigations/phase-29y-mir-lifecycle-vocab-consult.md` +3. (future design, separate phase)Plan 生成の正規化(相談パケット) - `docs/development/current/main/investigations/phase-286-plan-normalization-consult.md` -3. (optional, post self-host)REPL = script engine 構想(docs-only) - - `docs/reference/language/repl.md` ## Recently Completed diff --git a/docs/development/current/main/30-Backlog.md b/docs/development/current/main/30-Backlog.md index b25b4a15..d2d54cf6 100644 --- a/docs/development/current/main/30-Backlog.md +++ b/docs/development/current/main/30-Backlog.md @@ -18,7 +18,7 @@ Related: - 入口: `docs/development/current/main/phases/phase-287/README.md` - 手順: `docs/development/current/main/phases/phase-287/P1-INSTRUCTIONS.md` -- **Phase 284(planned, design-first): Return as ExitKind SSOT(patternに散らさない)** +- **Phase 284(✅ COMPLETE): Return as ExitKind SSOT(patternに散らさない)** - 目的: `return` を “pattern最適化の個別実装” にせず、`ExitKind` と `compose::*` / `emit_frag()` に収束させる - ねらい: 移行期間中の「二重ルール」「検出の穴」を減らし、将来の pattern 増殖を防ぐ - 入口: `docs/development/current/main/phases/phase-284/README.md` @@ -31,16 +31,16 @@ Related: - P0(docs-only)で “return の意味” と “Ok(None)/Err” の境界を固定 - P1+ で Rust/LLVM の実装を SSOT に収束(pattern側に例外実装を増やさない) -- **Phase 285(planned, design-first): Box lifecycle / weakref / finalization / GC SSOT** +- **Phase 285(active): Box lifecycle / weakref / finalization / GC SSOT** - 目的: Box の生存期間(強参照/弱参照/解放/最終化)を SSOT として固定し、「実装が仕様」になっている箇所を潰す - ねらい: - VM 側の weakref/finalization を仕様化(テストで固定) - LLVM harness 側の未対応/差分を “仕様として明文化” し、将来の実装計画を切る - 入口: `docs/development/current/main/phases/phase-285/README.md` - - スコープ案: - - P0(docs-only): 仕様SSOT + 用語 + ルート集合(roots)+ 禁止事項(finalizer内での再入など)を固定 - - P1(investigation): Rust VM 実装の棚卸し + LLVM harness の現状差分を記録 - - P2(smoke): weakref の最小 fixture/smoke を VM/(可能なら)LLVM で固定 + - 状況: + - P0/P1/P2 ✅ 完了(weak 成功パターンは smoke 固定) + - P2.1 ✅ 完了: hidden root を根治し、weak-fail smoke を PASS に復帰 + - P2.2 ✅ 完了: KeepAlive の二重責務を命令分離で解消(`KeepAlive`/`ReleaseStrong`) - 参考(現状の入口候補): - weakref 表現: `src/value.rs`(`NyashValue::WeakBox`) - finalization: `src/finalization.rs` @@ -59,6 +59,11 @@ Related: - 既存の `apps/tests/*.hako` fixture を再利用し、VM/LLVM parity のスモークが維持される。 - weak の語彙(`weak ` / `weak_to_strong()`)が同じ意味で動作する(cycleは当面リーク仕様でも可)。 +- **Phase 29y(planned, post self-host / docs-first): MIR lifecycle vocab freeze(RC/weak/ABI)** + - 目的: 参照カウント(strong/weak)を “どこで” 実装するか(MIR語彙 vs runtime ABI)を設計SSOT化し、脱Rust実装の土台にする + - 前提: self-host 後/Phase 285(weak conformance + hidden root 根治)が落ち着いていること + - 入口(相談パケット): `docs/development/current/main/investigations/phase-29y-mir-lifecycle-vocab-consult.md` + - **Phase 286(✅ complete): JoinIR Line Absorption(JoinIR→CorePlan/Frag 収束)** - 目的: 移行期間に残っている「2本の lowering(Plan line / JoinIR line)」を、構造で 1 本に収束させる - ねらい: `return/break/continue` のような “大きな出口語彙” の実装場所が揺れない状態にする diff --git a/docs/development/current/main/phases/phase-285/README.md b/docs/development/current/main/phases/phase-285/README.md index 02e323a3..28d8ad46 100644 --- a/docs/development/current/main/phases/phase-285/README.md +++ b/docs/development/current/main/phases/phase-285/README.md @@ -1,6 +1,6 @@ # Phase 285: Box lifecycle / weakref / finalization / GC conformance -Status: P0/P1/P2/P2.1 ✅ COMPLETE (2025-12-26) +Status: P0/P1/P2/P2.1/P2.2 ✅ COMPLETE (2025-12-26) ## Next (P0 docs-only → P1/P2) @@ -29,6 +29,31 @@ MIR 命令 `KeepAlive` を “スコープ維持 / 上書きdrop” の両方に 実装の責務分離(hygiene): - VM 側の KeepAlive 処理は `src/backend/mir_interpreter/handlers/lifecycle.rs` に隔離(dispatch から分離) +## P2.2(optional, hygiene)KeepAlive 命令の明確化(命令分離) + +**ねらい**: `KeepAlive { values, drop_after: bool }` の “二重責務” を解消し、意図を MIR 語彙で明確化する。 + +- 現状: + - `drop_after=false`: スコープ終端までの生存維持(PHI/スコープ意味論のため) + - `drop_after=true`: 変数上書き時の強参照解放(hidden root 対策) +- 課題: + - “生存維持” と “解放” は本質が違い、`bool` で隠すとレビュー/検証で混線しやすい + +**方針(提案)**: +- `KeepAlive { values }`(PURE): DCE/liveness 目的の生存維持のみ +- `ReleaseStrong { values }`(WRITE/IMPURE): 変数上書き等で強参照を解放(alias も含めて解放) + +**受け入れ条件**: +- `weak_basic` が壊れない(言語スコープ優先) +- `weak_upgrade_fail` が PASS(`x = null` 後に `weak_to_strong()` が `null`) +- `./tools/smokes/v2/run.sh --profile quick` が緑(154/154 PASS) +- `rg -n "drop_after" src` が 0 件 + +**結果**: ✅ COMPLETE (2025-12-26) + +- `KeepAlive { values, drop_after }` → `KeepAlive { values }`(PURE)/ `ReleaseStrong { values }`(WRITE)に分離 +- 実装コミット: `3bb865c6b` + ### Verification - `apps/tests/phase285_weak_basic.hako`: exit 2 ✅