docs(phase181): Update CURRENT_TASK.md with Phase 181 completion and Phase 182 preview

This commit is contained in:
nyash-codex
2025-12-04 20:49:25 +09:00
parent 694a5ebadd
commit e158d382ff

View File

@ -1,5 +1,82 @@
# Current Task
## 🎉 Phase 181: JoinIR Unification Planning Completed (2025-12-04)
**Status**: ✅ **All 4 Tasks Completed** → Phase 182 Implementation Ready
**Summary**: Phase 181 successfully completed comprehensive planning for JoinIR mainline unification before selfhost depth-2. All 4 tasks delivered detailed analysis totaling **1,698+ lines of documentation**, revealing critical insights that make Phase 182-183 implementation straightforward.
### Key Achievements
1. **LoopBuilder Audit Complete** (Task 1)
- **67 references across 20 files** - comprehensive inventory
- **Single instantiation point** discovered: `control_flow.rs:60` → surgical replacement possible
- Internal module isolation confirmed (40/67 references are internal)
2. **JOINIR_TARGETS Mapping Complete** (Task 2)
- **6 current functions** (3 Exec, 3 LowerOnly)
- **50% are LowerOnly** → Exec upgrade is critical priority
- **Function-specific gaps are rare** → general patterns cover 80%
3. **JOINIR_CORE Smoke Testing Complete** (Task 3)
- **80% selfhost PASS** (4/5 tests) with general patterns
- **1 critical gap** identified: `IfSelectTest.test/1` (not in JOINIR_TARGETS)
- **hako_check blocked** by non-JOINIR "void" error (can defer to Phase 183)
4. **Representative Path Set Finalized** (Task 4)
- **10 representative paths** confirmed (Selfhost: 5, hako_check: 2, Stage-B: 2, Stage-1: 1)
- **Phase 182 action items** prioritized (3-week implementation timeline)
- **Phase 183 entry criteria** defined (4 hard requirements, 2 optional)
### Critical Insights for Phase 182
**Insight 1**: General patterns (Case A/B/C, If-Select) cover 80% of selfhost → focus on compiler infrastructure, not user code patterns.
**Insight 2**: LoopBuilder has single instantiation point → surgical replacement is low-risk with clear rollback path.
**Insight 3**: LowerOnly → Exec upgrade is key → 3 functions need upgrade before LoopBuilder removal.
**Insight 4**: hako_check void error is non-JOINIR → can proceed independently, defer to Phase 183 if needed.
### Phase 182 Implementation Plan (2-3 weeks)
**Week 1: Critical Path (Selfhost)** - 2 days
1. Add `IfSelectTest.test/1` to JOINIR_TARGETS (Exec) - 1 day
2. Verify all 5 selfhost tests pass with strict mode - 1 day
**Week 2: Stage-1/Stage-B Exec Upgrades** - 5 days
3. Upgrade `Stage1UsingResolverBox.resolve_for_source/5` to Exec - 2 days
4. Upgrade `StageBBodyExtractorBox.build_body_src/2` to Exec - 1 day
5. Upgrade `StageBFuncScannerBox.scan_all_boxes/1` to Exec - 1 day
6. Verify Stage-1/Stage-B pipelines - 1 day
**Week 3-4 (Optional): hako_check Integration** - 6 days
7. Fix "undefined variable: void" error - 2-3 days
8. Add hako_check functions to JOINIR_TARGETS - 1-2 days
9. Verify hako_check tests pass - 1 day
### Phase 183 Preview
After Phase 182 completion:
1. Set JoinIR as default (`NYASH_JOINIR_CORE=1` in all scripts)
2. Delete LoopBuilder module (`src/mir/loop_builder/`, ~1,000+ lines)
3. Create legacy opt-in (`NYASH_LEGACY_LOOPBUILDER=1` for dev/testing)
4. Update documentation (replace all LoopBuilder → JoinIR Frontend references)
**Timeline**: 1-2 weeks (primarily documentation and cleanup)
### Deliverables
All Phase 181 deliverables are in `docs/private/roadmap2/phases/phase-181/`:
- `loopbuilder-audit.md` (615 lines) - Complete usage audit
- `joinir-targets-mapping.md` (227 lines) - JOINIR_TARGETS inventory
- `joinir-core-smoke-results.md` (356 lines) - Smoke test results
- `representative-paths-finalized.md` (500+ lines) - Representative path set
**Full details**: [Phase 180-181 README](docs/private/roadmap2/phases/phase-180-joinir-unification-before-selfhost/README.md)
---
## 🚀 Phase 161: JoinIR/MIR を .hako で読む Analyzer 実装へ (2025-12-04)
**Status**: ✅ **設計完全完了** → Task 4基本実装へ移行準備完了
@ -457,6 +534,16 @@ Rust は「足場Ring0テストハーネス」、言語本体の SSOT は
- Phase 160 は設計専用フェーズとして、subphase 161169 の役割と境界JoinIR Analyzer / .hako JoinIR/MIR 試作 / A/B ハーネス / selfhost 限定適用 / depth2 条件)を docs にまとめる。
- 実装は Phase 161 以降に小さく分割し、常に「Rust JoinIR/MIR を正として A/B 比較しながら .hako 側へ寄せていく」方針で進行する。
### 7. JoinIR 統一 & デフォルト ONPhase 180183
- 目的:
- StageB / Stage1 / selfhost / hako_check の代表パスから旧 LoopBuilder / legacy MIR 経路を追い出し、JoinIR を実質デフォルト ONcore/mainlineにする。
- `.hako JoinIR/MIR` に移植する対象を「JoinIR 経路に乗った綺麗なコード」に限定し、古い LoopBuilder 由来の複雑な制御フローを新しい実装に持ち込まないようにする。
- 方針:
- Phase 180 は設計フェーズとして、JOINIR_TARGETS と LoopBuilder 利用箇所のインベントリ、および StageB/Stage1/selfhost/hako_check の代表パスの洗い出しを行う。
- Phase 181182 で代表関数を順次 JoinIR mainline に乗せ、LoopBuilder を dev/互換専用の残り範囲に縮退させる。
- Phase 183 で Runner/selfhost/hako_check の既定挙動を `NYASH_JOINIR_CORE=1` に揃え、必要なら legacy 用の dev トグルのみを残す(既定 OFF
---
## 🎉 Phase 150: Selfhost Stage-3 Depth-1 ベースライン強化(完了)✅ 2025-12-04