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:
2025-12-20 01:24:04 +09:00
parent 575a5d750f
commit 64f679354a
11 changed files with 1206 additions and 14 deletions

View File

@ -38,20 +38,17 @@
- `cargo check` は通過0 errors
- `--profile quick` は次の FAIL が残る → Phase 253`[joinir/mutable-acc-spec]`
## 2025-12-19Phase 255Multi-param loop wiring🔜 ← 現在ここ!
## 2025-12-19Phase 255Multi-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-19Phase 256StringUtils.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-19Phase 254index_of loop pattern✅ 完了Blocked by Phase 255

View File

@ -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

View File

@ -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 APattern 7 新設)を推奨。
理由:
- 可変 stepthen: `i = start` / else: `i = i + 1`)は既存の ConstStep 前提と相性が悪い。
- Pattern 2 を膨らませず、tokenization 系の “専用パターン” として箱化した方が責務が綺麗。
### P0 タスク
1) 最小 fixture + v2 smokeintegration
- `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 以前の問題(可変ステップ)