Files
hakorune/CURRENT_TASK.md
nyash-codex 42f8f4d088 docs: Update CURRENT_TASK.md - Phase 91 planning complete
## P1 Status Update
- Phase 91 Step 1:  COMPLETE
  - Loop inventory: 34 loops across 6 files
  - Pattern P5b design: Complete
  - Test fixture: Created
  - Capability taxonomy: Extended

- Phase 91 Step 2: NEXT (Implementation)
  - detect_escape_pattern() in Canonicalizer
  - Unit tests + parity verification
  - No lowering in Step 2 (deferred to Step 3)

## Key Findings
- Current JoinIR readiness: 47% (16/30 loops)
- Pattern P5b unlocks: All escape sequence parsers
- Effort estimate: 2-3 days for recognition phase

## Next Priority
Phase 91 Step 2: Implement Canonicalizer recognition for P5b pattern

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-16 14:22:55 +09:00

140 lines
7.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Current Task
このファイルは「いま何に集中しているか」と「次にやり得る候補」だけを書く軽量ビューだよ。
詳細は `docs/development/current/main/` 以下の各 Phase 文書と、JoinIR の SSOT である
`docs/development/current/main/joinir-architecture-overview.md` を参照してね。
最終更新: 2025-12-16
過去ログ(肥大化した旧 CURRENT_TASKはここに退避したよ:
- `docs/development/current/main/CURRENT_TASK_ARCHIVE_2025-12-13.md`
---
## 今の状態Phase 7490 まで到達)
- Scope/BindingId の段階移行dev-onlyは Pattern2/3/4 まで配線済みdual-path 維持)。
- Pattern2 の promoted carriersDigitPos/Trimについて ExitLine 契約ConditionOnly を exit PHI から除外)を E2E で固定済み。
- debug flag SSOT / DebugOutputBox 移行 / error tags 集約 / carrier init builder まで整備済み。
- **LLVM exe line SSOT 確立**: `tools/build_llvm.sh` を使用した .hako → executable パイプライン標準化完了。
- **LLVM AOTPython llvmliteループ復旧**: `apps/tests/loop_min_while.hako` が EMIT/LINK/RUN まで到達Phase 131-3..10)。
- Case C`loop(true)` + break/continueは Phase 131-11 で Pattern/shape guard を整備し、Phase 132-P2 で LLVM EXE まで parity`Result: 3`)を確認。
- **Phase 132 完了**: ループ exit 値exit PHI / boundaryの VM/LLVM parity を根治。
- JoinIR/Boundary: exit 値を境界に明示的に渡す
- LLVM Python: PHI を落とす/上書きする経路を除去PHI SSOT を保護)
- JoinIR merge: exit PHI dst の allocator を function-level に統一ValueId 衝突を排除)
- debug-only: Exit PHI collision を早期検出する verifier を追加LLVM 実行時に壊れる前に Fail-Fast
- **Phase 133 完了**: Promoted carrier の `join_id` 解決Trimを SSOT に寄せて根治smoke は compile-only
- **Phase 134 完了**: Plugin loader best-effort loading決定的順序 + failure 集約 + 継続)を導入。
- **Phase 135 完了**: ConditionLoweringBox allocator SSOTP0: 根治修正 + P1: contract_checks Fail-Fast 強化)。
- **Phase 136 完了**: MirBuilder Context SSOT 化(+ ValueId allocator 掃討)。
- **Phase 137-141 完了**: Loop Canonicalizer前処理 SSOTを実装・箱化・型安全化・統合・ドキュメントまで完了既定挙動は不変
- **Phase 88 完了**: continue + 可変ステップi=i+const 差分)を dev-only fixture で固定、StepCalculator Box 抽出。
- **Phase 89 完了**: P0ContinueReturn detector+ P1lowering 実装)完了。
- **Phase 90 完了**: ParseStringComposite + `Null` literal + ContinueReturn同一値の複数 return-ifを dev-only fixture で固定。
- `cargo test --release --lib` は PASS を維持993 passed、退行なし
参照:
- `docs/development/current/main/10-Now.md`
- `docs/development/current/main/phase86-90-loop-frontends-summary.md`
- `docs/development/current/main/phase73-scope-manager-design.md`
- `docs/development/current/main/phase80-bindingid-p3p4-plan.md`
- `docs/development/current/main/phase81-pattern2-exitline-contract.md`
- `docs/development/current/main/phase78-85-boxification-feedback.md`
- `docs/development/current/main/phase87-selfhost-llvm-exe-line.md`
- `docs/development/current/main/phase131-2-box-resolution-map.md`
- `docs/development/current/main/phase131-3-llvm-lowering-inventory.md`
- `docs/development/current/main/phase131-5-taglink-fix-summary.md`
- `docs/development/current/main/phases/phase-132/README.md`
- `docs/development/current/main/investigations/phase132-llvm-exit-phi-wrong-result.md`
- `docs/development/current/main/investigations/phase132-case-c-llvm-exe.md`
---
## 次の指示書(優先順位)
### P0: Canonicalizer の適用範囲拡大(実ループ 1 本)
**状態**: ✅ Phase 137-141 完了、次は “適用対象を増やす” 段階
**目的**: canonicalizer を「実アプリ由来ループ」に 1 本ずつ適用し、認識→decision→strict parity を増やして coverage を広げる既定挙動は不変、dev-only
SSOT:
- `docs/development/current/main/design/loop-canonicalizer.md`
実装:
- `src/mir/loop_canonicalizer/mod.rs`
SSOT入口
- `src/mir/builder/control_flow/joinir/routing.rs``choose_pattern_kind`
**次に触るSSOT**:
- Loop系の設計: `docs/development/current/main/joinir-architecture-overview.md`
注意:
- 既定挙動は変えないdev-only で観測→段階投入)
- 新しい環境変数は増やさない(`joinir_dev_enabled()` の範囲で観測する)
### P1: JoinIR / Selfhost depth-2 の前進Phase 91 - 設計完了)
**状態**: ✅ **Phase 91 計画完了** → 次は実装フェーズ
**目的**: Selfhost コンパイラの未対応ループを JoinIR 対象に拡大
**成果Phase 91 Step 1**:
- ✅ ループ在庫分析: 34ループ across 6ファイル47% JoinIR対応
- ✅ Pattern P5b (Escape Handling) デザイン完成
- ✅ テストフィクスチャ作成 (`test_pattern5b_escape_minimal.hako`)
- ✅ Capability 拡張P5b専用タグ
**優先順位**:
1. **P5b (Escape Handling)** - `json_loader.hako:30` (8行)
- Effort: 2-3日
- Impact: JSON/CSV パーサー全般を JoinIR 対応可能に
- Status: 設計完了、実装待ち
2. **P5 (Guard-Bounded)** - `mini_vm_core.hako:541` (204行)
- Effort: 1-2週
- Impact: 大規模ループ最適化guard counter除去
- Status: 分析完了、設計待ち
3. **P6 (Nested Loops)** - `seam_inspector.hako:76` (7+ levels)
- Effort: 2-3週
- Impact: 深い入れ子対応(将来)
- Status: 候補識別完了
**次に触るSSOT**:
- Phase 91 詳細計画: `docs/development/current/main/phases/phase-91/README.md`
- P5b デザイン: `docs/development/current/main/design/pattern-p5b-escape-design.md`
- Loop Canonicalizer: `docs/development/current/main/design/loop-canonicalizer.md`
**Phase 91 Step 2 (次)**: Canonicalizer 実装
1. `detect_escape_pattern()` 関数追加
2. Unit tests (P5b 認識)
3. Parity verification (strict mode)
4. Documentation 更新
受け入れ基準:
- ✅ P5b パターン認識で `decision.chosen == Pattern5bEscape`
-`missing_caps == []`(すべての capability 充足)
-`HAKO_JOINIR_STRICT=1` で parity green
- ✅ 既存テスト退行なし
### P2: Ownership/Relay runtime 対応の再開Phase 92 候補)
目的:
- multihop/merge relay を “runtime でも” 受理できるところまで契約を伸ばすFail-Fast の段階解除)。
受け入れ基準:
- dev-only 既定OFF のまま、既存ラインを壊さない。
### Done: Phase 8690Loop frontends
- まとめSSOT: `docs/development/current/main/phase86-90-loop-frontends-summary.md`
- MirBuilder の入口Context 分割): `src/mir/builder/README.md` + `docs/development/current/main/01-JoinIR-Selfhost-INDEX.md`
---
## すぐ走らせる確認コマンド
- `cargo test --release --lib`
- `NYASH_JOINIR_NORMALIZED_DEV_RUN=1 cargo test --features normalized_dev --test normalized_joinir_min -- --nocapture`