feat(control_tree): Phase 133 P0 - Multiple post-loop assigns support
Extend Phase 132's loop(true) + post-loop to accept multiple assignments:
Goal: `x=0; loop(true){ x=1; break }; x=x+2; x=x+3; return x` → exit code 6
Implementation:
- Extended loop_true_break_once.rs pattern detection (len() == 2 → len() >= 2)
- Added iterative assignment lowering (for loop over post_nodes)
- Reused Phase 130's lower_assign_stmt for each assignment
- Maintained ExitMeta DirectValue mode (PHI-free)
Changes:
- apps/tests/phase133_loop_true_break_once_post_multi_add_min.hako (new fixture)
- tools/smokes/v2/profiles/integration/apps/phase133_*_multi_add_*.sh (new smokes)
- src/mir/control_tree/normalized_shadow/loop_true_break_once.rs (+30 lines)
- docs/development/current/main/phases/phase-133/README.md (new documentation)
- docs/development/current/main/10-Now.md (Phase 133 entry added)
Scope (Phase 130 baseline):
- ✅ x = <int literal>
- ✅ x = y (variable copy)
- ✅ x = x + <int literal> (increment)
- ❌ Function calls / general expressions (future phases)
Design principles:
- Minimal change: ~30 lines added
- SSOT preservation: env_post_k remains single source of truth
- Reuse: Leveraged existing lower_assign_stmt
- Fail-Fast: Contract violations trigger freeze_with_hint
Test results:
- cargo test --lib: 1176 PASS
- Phase 133 VM: PASS (exit code 6)
- Phase 133 LLVM EXE: PASS (exit code 6)
- Phase 132 regression: PASS (exit code 3)
- Phase 131 regression: PASS (exit code 1)
- Phase 97 regression: PASS
Architecture maintained:
- 5-function structure unchanged (main/loop_step/loop_body/k_exit/post_k)
- PHI-free DirectValue mode
- Zero changes to ExitMeta, merge logic, or JoinIR contracts
Related: Phase 133 loop(true) + multiple post-loop assignments
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,5 +1,26 @@
|
||||
# Self Current Task — Now (main)
|
||||
|
||||
## 2025-12-18:Phase 133 完了 ✅
|
||||
|
||||
**Phase 133: loop(true) break-once + multiple post-loop assigns(dev-only)**
|
||||
- 目的: Phase 132 を拡張し、post-loop で複数の assign を受理(PHI-free 維持)
|
||||
- 仕様:
|
||||
- `loop(true) { x = 1; break }; x = x + 2; x = x + 3; return x` は exit code `6`(VM/LLVM EXE parity)
|
||||
- post_nodes 検出を `len() == 2` から `len() >= 2` に拡張
|
||||
- 複数 assign を iterative に lower(LegacyLowerer::lower_assign_stmt 再利用)
|
||||
- 実装:
|
||||
- `src/mir/control_tree/normalized_shadow/loop_true_break_once.rs`(3箇所編集、~30行追加)
|
||||
- Pattern detection: all_assigns + ends_with_return
|
||||
- Post-loop lowering: for loop で複数 assign 処理
|
||||
- SSOT: env_post_k が最終値を保持(ExitMeta に反映)
|
||||
- Fixture: `apps/tests/phase133_loop_true_break_once_post_multi_add_min.hako`(期待: 6)
|
||||
- Smoke:
|
||||
- `phase133_loop_true_break_once_post_multi_add_vm.sh` PASS
|
||||
- `phase133_loop_true_break_once_post_multi_add_llvm_exe.sh` PASS
|
||||
- Regression: Phase 132/131/97 維持確認(全 PASS)
|
||||
- Unit tests: 1176/1176 PASS
|
||||
- 入口: `docs/development/current/main/phases/phase-133/README.md`
|
||||
|
||||
## 2025-12-18:Phase 130 完了 ✅
|
||||
|
||||
**Phase 130: if-only Normalized "Small Expr/Assign" Expansion(dev-only)**
|
||||
|
||||
Reference in New Issue
Block a user