Phase 61: structural if-sum+break lowering (dev-only)

This commit is contained in:
nyash-codex
2025-12-12 22:15:41 +09:00
parent 6aba138950
commit acb6720d9b
13 changed files with 1140 additions and 39 deletions

View File

@ -138,8 +138,11 @@ pub struct OwnershipPlan {
- **Phase 57**: OwnershipAnalyzer implementation (dev-only)
- **Phase 58**: P2 plumbing (dev-only)
- **Phase 59**: P3 plumbing (dev-only)
- **Phase 60**: Cleanup dev heuristics
- **Phase 61**: Canonical promotion decision
- **Phase 60**: Single-hop relay threading for fixtures (dev-only)
- **Phase 61**: P3 側の接続点を決めて段階接続dev-only
- まずは fixtures ルートProgram(JSON v0)で、if-sum+break を別箱として構造的に接続する
- 詳細: `docs/development/current/main/PHASE_61_SUMMARY.md`
- MIR→JoinIR の本番ルート(`pattern3_with_if_phi.rs`)へ寄せるのは別フェーズで設計→接続
## Module Boundary
@ -244,6 +247,13 @@ loop {
### Implementation Details
**Input JSON Compatibility**:
- テスト用の簡易スキーマ: top-level `functions` + stmt/expr の `kind` を解釈
- Program(JSON v0): top-level `defs` + stmt/expr の `type` を解釈
- `Local` は JSON v0 で「新規束縛」と「rebind/update」が混在し得るため、
解析では「scope chain で既に定義済みなら write / 未定義なら define」として扱うdev-only 前提)。
- Note: `docs/private` は submodule のため、fixture JSON を参照する場合は submodule 側で追跡されていることを前提とする。
**Body-Local Ownership Rule**:
```rust
// Example: local in if/block → enclosing loop owns it
@ -267,5 +277,9 @@ loop {
## Status
- ✅ Phase 56: Design + interface skeleton completed
- ✅ Phase 57: Analyzer implemented (dev-only, not connected to lowering yet)
- Phase 58+: Plumbing integration pending
- ✅ Phase 57: Analyzer implemented (dev-only)
- Phase 58-59: plan_to_lowering helpers (P2/P3) with Fail-Fast relay
- ✅ Phase 60 (dev-only): single-hop relay threading for P2 fixtures
- `plan_to_p2_inputs_with_relay` promotes relay_writes to carriers (relay_path.len()<=1 only)
- Frontend Break(P2) lowering uses ownership-with-relay; legacy path preserved for comparison
- P3 stays analysis-only; real threading is Phase 61+