|
|
3a82633924
|
refactor(funcscanner): Region+next_i パターン統一 & SSA テスト追加
**FuncScanner .hako 側改善**:
- scan_all_boxes を Region + next_i 形式に統一(continue 多発による SSA/PHI 複雑さ削減)
- インデント修正(タブ→スペース統一)
- デバッグ print 削除
**SSA テスト追加**:
- lang/src/compiler/tests/funcscanner_scan_methods_min.hako
- src/tests/mir_funcscanner_ssa.rs (scan_methods & fib_min SSA デバッグテスト)
**Phase 25.3 ドキュメント**:
- docs/development/roadmap/phases/phase-25.3-funcscanner/ 追加
**関連**: Phase 25.3 FuncScanner 箱化準備作業
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-20 06:38:43 +09:00 |
|
|
|
525e59bc8d
|
feat(loop-phi): Add body-local variable PHI generation for Rust AST loops
Phase 25.1c/k: Fix ValueId undefined errors in loops with body-local variables
**Problem:**
- FuncScannerBox.scan_all_boxes/1 and BreakFinderBox._find_loops/2 had ValueId
undefined errors for variables declared inside loop bodies
- LoopFormBuilder only generated PHIs for preheader variables, missing body-locals
- Example: `local ch = s.substring(i, i+1)` inside loop → undefined on next iteration
**Solution:**
1. **Rust AST path** (src/mir/loop_builder.rs):
- Detect body-local variables by comparing body_end_vars vs current_vars
- Generate empty PHI nodes at loop header for body-local variables
- Seal PHIs with latch + continue snapshot inputs after seal_phis()
- Added HAKO_LOOP_PHI_TRACE=1 logging for debugging
2. **JSON v0 path** (already fixed in previous session):
- src/runner/json_v0_bridge/lowering/loop_.rs handles body-locals
- Uses same strategy but for JSON v0 bridge lowering
**Results:**
- ✅ FuncScannerBox.scan_all_boxes: 41 body-local PHIs generated
- ✅ Main.main (demo harness): 23 body-local PHIs generated
- ⚠️ Still some ValueId undefined errors remaining (exit PHI issue)
**Files changed:**
- src/mir/loop_builder.rs: body-local PHI generation logic
- lang/src/compiler/entry/func_scanner.hako: debug logging
- /tmp/stageb_funcscan_demo.hako: test harness
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-19 23:12:01 +09:00 |
|
|
|
80f8a7bc8c
|
🔧 Hotfix 7 (Enhanced): ValueId receiver alias tracking for nested loops
- Problem: Pinned receiver variables in loops cause undefined ValueId errors
- Enhanced fix: Update all receiver aliases (me + all __pin$N$@recv levels)
- Handles nested loops by updating previous pin levels
- Test status: Partial improvement, ValueId(50) → ValueId(40)
- Further investigation needed for complete fix
Files modified:
- src/mir/phi_core/loopform_builder.rs (emit_header_phis)
|
2025-11-19 00:02:41 +09:00 |
|
|
|
7ca7f646de
|
Phase 25.1b: Step2完了(FuncBodyBasicLowerBox導入)
Step2実装内容:
- FuncBodyBasicLowerBox導入(defs専用下請けモジュール)
- _try_lower_local_if_return実装(Local+単純if)
- _inline_local_ints実装(軽い正規化)
- minimal lowers統合(Return/BinOp/IfCompare/MethodArray系)
Fail-Fast体制確立:
- MirBuilderBox: defs_onlyでも必ずタグ出力
- [builder/selfhost-first:unsupported:defs_only]
- [builder/selfhost-first:unsupported:no_match]
Phase構造整備:
- Phase 25.1b README新設(Step0-3計画)
- Phase 25.2b README新設(次期計画)
- UsingResolverBox追加(using system対応準備)
スモークテスト:
- stage1_launcher_program_to_mir_canary_vm.sh追加
Next: Step3 LoopForm対応
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-15 22:32:13 +09:00 |
|
|
|
9e2fa1e36e
|
Phase 21.6 solidification: chain green (return/binop/loop/call); add Phase 21.7 normalization plan (methodize static boxes). Update CURRENT_TASK.md and docs.
|
2025-11-11 22:35:45 +09:00 |
|