fix(joinir): Phase 256 P1 - Carrier PHI wiring and parameter mapping (in progress)
**Status**: Core carrier PHI issue partially resolved, debugging loop body **Progress**: ✅ Task 1: split_scan_minimal.rs Carriers-First ordering (6 locations) ✅ Task 2: pattern7_split_scan.rs boundary configuration (host/join inputs, exit_bindings, expr_result) ✅ Result now flows from k_exit to post-loop code (RC issue resolved) ⚠️ Loop body instruction execution needs review **Key Fixes**: 1. Fixed host_inputs/join_inputs to match main() params Carriers-First order 2. Added result to exit_bindings (CarrierRole::LoopState) 3. Added result back to loop_invariants for variable initialization 4. Added expr_result=join_exit_value_result for loop expression return 5. Fixed jump args to k_exit to include all 4 params [i, start, result, s] **Current Issue**: - Loop body type errors resolved (String vs Integer fixed) - New issue: Loop body computations (sep_len) undefined in certain blocks - Likely cause: JoinIR→MIR conversion of local variables needs review **Next Steps**: - Review JoinValueSpace allocation and ValueId mapping in conversion - Verify loop_step instruction ordering and block structure - May need to refactor bound computation or revisit split algorithm 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -38,20 +38,17 @@
|
||||
- `cargo check` は通過(0 errors)
|
||||
- `--profile quick` は次の FAIL が残る → Phase 253(`[joinir/mutable-acc-spec]`)
|
||||
|
||||
## 2025-12-19:Phase 255(Multi-param loop wiring)🔜 ← 現在ここ!
|
||||
## 2025-12-19:Phase 255(Multi-param loop wiring)✅
|
||||
|
||||
- Phase 255 README: `docs/development/current/main/phases/phase-255/README.md`
|
||||
- Goal: Pattern 6 (index_of) の integration テストを PASS にする
|
||||
- Current first FAIL:
|
||||
- `VM error: use of undefined value ValueId(10)` (StringUtils.index_of/2)
|
||||
- 根本原因: JoinIR boundary/PHI システムが単一ループ変数前提で、3変数ループ(s, ch, i)に未対応
|
||||
- 方針:
|
||||
- Boundary に `loop_invariants` フィールド追加(LoopState と invariants を分離)
|
||||
- PHI 生成ロジックを拡張して invariants の PHI を作成
|
||||
- 受け入れ:
|
||||
- phase254_p0_index_of_vm.sh PASS
|
||||
- phase254_p0_index_of_llvm_exe.sh PASS
|
||||
- `--profile quick` の最初の FAIL が次へ進む
|
||||
- Status:
|
||||
- Pattern6/index_of が VM/LLVM で PASS
|
||||
- `loop_invariants` を導入して ConditionOnly 誤用を根治
|
||||
|
||||
## 2025-12-19:Phase 256(StringUtils.split/2 可変 step ループ)🔜
|
||||
|
||||
- Phase 256 README: `docs/development/current/main/phases/phase-256/README.md`
|
||||
- Current first FAIL: `StringUtils.split/2`(Missing caps: `ConstStep` → freeze)
|
||||
|
||||
## 2025-12-19:Phase 254(index_of loop pattern)✅ 完了(Blocked by Phase 255)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Status: Active
|
||||
Status: Completed
|
||||
Scope: Phase 255 (Pattern 6 multi-param loop wiring/PHI 対応)
|
||||
Related:
|
||||
- docs/development/current/main/10-Now.md
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Phase 256: StringUtils.split/2 Pattern Support
|
||||
|
||||
Status: Planning
|
||||
Status: Active
|
||||
Scope: Loop pattern recognition for split/tokenization operations
|
||||
Related:
|
||||
- Phase 255 完了(loop_invariants 導入、Pattern 6 完成)
|
||||
@ -131,6 +131,54 @@ Missing caps: [ConstStep]
|
||||
3. **Option 選択**: Pattern 7 新設 vs Pattern 2 拡張 vs Normalization
|
||||
4. **実装戦略策定**: 選択した Option の詳細設計
|
||||
|
||||
---
|
||||
|
||||
## Phase 256 指示書(P0)
|
||||
|
||||
### 目標
|
||||
|
||||
- `StringUtils.split/2` の loop を JoinIR で受理し、`json_lint_vm` を PASS に戻す。
|
||||
- by-name 分岐禁止(`StringUtils.split/2` だけを特別扱いしない)。
|
||||
- workaround 禁止(fallback は作らない)。
|
||||
|
||||
### 推奨方針(P0)
|
||||
|
||||
Option A(Pattern 7 新設)を推奨。
|
||||
|
||||
理由:
|
||||
- 可変 step(then: `i = start` / else: `i = i + 1`)は既存の ConstStep 前提と相性が悪い。
|
||||
- Pattern 2 を膨らませず、tokenization 系の “専用パターン” として箱化した方が責務が綺麗。
|
||||
|
||||
### P0 タスク
|
||||
|
||||
1) 最小 fixture + v2 smoke(integration)
|
||||
- `apps/tests/phase256_p0_split_min.hako`
|
||||
- `tools/smokes/v2/profiles/integration/apps/phase256_p0_split_vm.sh`
|
||||
- `tools/smokes/v2/profiles/integration/apps/phase256_p0_split_llvm_exe.sh`
|
||||
|
||||
2) DetectorBox(構造のみ)
|
||||
- ループ条件が `i <= s.length() - sep.length()` 形
|
||||
- body に `if substring(i, i + sep.length()) == sep { ... i = start } else { i = i + 1 }`
|
||||
- `result.push(...)` を含む(ArrayBox accumulator)
|
||||
- ループ後に “残り push” がある(任意だがあると精度が上がる)
|
||||
|
||||
3) 抽出箱(Parts)
|
||||
- `i` / `start` / `result` / `s` / `separator` を抽出
|
||||
- then/else の更新式(可変 step と const step)を抽出
|
||||
|
||||
4) JoinIR lowerer(専用)
|
||||
- loop_state: `i`, `start`
|
||||
- invariants: `s`, `separator`, `result`(result は更新されるので carrier 扱いが必要なら role を明確に)
|
||||
- then/else で異なる `i_next` を `Select` もしくは branch で表現(設計 SSOT は JoinIR 側で決める)
|
||||
|
||||
5) 検証
|
||||
- integration smokes 2本が PASS
|
||||
- `./tools/smokes/v2/run.sh --profile quick` の最初の FAIL が次へ進む
|
||||
|
||||
### 注意(P0ではやらない)
|
||||
- 既存 Pattern の大改造(Pattern 2 の全面拡張)は避ける
|
||||
- 正規化(Normalization 経路)は P1 以降の検討に回す
|
||||
|
||||
## 備考
|
||||
|
||||
- Phase 255 で loop_invariants が導入されたが、このケースは invariants 以前の問題(可変ステップ)
|
||||
|
||||
Reference in New Issue
Block a user