|
|
1510dcb7d8
|
fix(llvm): Phase 131-6 調査 - TAG-RUN 3バグ発見(1修正/1部分/1未修正)
Phase 131-6: Infinite Loop Bug 調査完了
発見したバグ(3件):
1. Bug #1: Copy-to-PHI 命令(SSA 違反)✅ 修正完了
- instruction_rewriter.rs: PHI destination への Copy をスキップ
2. Bug #2: Type Inference 混同(String vs Integer)⚠️ 部分修正
- binop.py: force_string ロジック削除
3. Bug #3: SSA Dominance Violation ❌ 未修正
- MIR builder が定義前に値を使用(根本問題)
変更ファイル:
- src/mir/builder/control_flow/joinir/merge/instruction_rewriter.rs:
- Lines 428-443: header PHI への Copy スキップ追加
- src/llvm_py/instructions/binop.py:
- Lines 128-159: force_string 削除、Phase 131-6 コメント追加
- docs/development/current/main/phase131-3-llvm-lowering-inventory.md:
- 3バグの詳細追記
テスト結果:
- Case A/B2: ✅ 退行なし
- Case B: ❌ infinite loop 継続(Bug #3 が原因)
- Simple Add: ❌ 0 を出力(期待: 1)
Next: Phase 131-6 続き - MIR SSA dominance 根治
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2025-12-14 06:52:50 +09:00 |
|
|
|
9e76173c99
|
fix(llvm): Phase 131-5 完了 - TAG-LINK 修正(ExternCall symbol mapping)
Phase 131-5: ExternCall Symbol Mapping 修正
問題:
- Case B (loop_min_while.hako) が TAG-LINK で失敗
- エラー: undefined reference to `nyash_console_log`
根本原因:
- Python harness が dot → underscore 変換を実行
(`nyash.console.log` → `nyash_console_log`)
- NyKernel は `nyash.console.log` をエクスポート
(ELF format では dot が有効)
修正:
- src/llvm_py/instructions/externcall.py から変換ロジックを削除(-4 lines)
- Symbol 名は NyKernel exports と完全一致
変更ファイル:
- src/llvm_py/instructions/externcall.py:
- 不要な dot→underscore 変換削除
- ELF symbol 仕様のコメント追加
テスト結果:
- Case B LINK: ❌→✅ (修正成功)
- Case B RUN: ❌ (新 TAG-RUN: infinite loop)
- Case A/B2: ✅ (退行なし)
箱化モジュール化:
- ✅ SSOT 達成: NyKernel exports を信頼
- ✅ クリーンな修正: 不要コード削除のみ
- 推奨: NyKernel symbol naming convention ドキュメント化
Next: Phase 131-6 (TAG-RUN 修正 - infinite loop)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-14 06:25:42 +09:00 |
|
|
|
73613dcef0
|
feat(llvm): Phase 131-4 P1 完了 - PHI ordering 修正(multi-pass architecture)
Phase 131-4 P1: PHI After Terminator Bug 修正
問題:
- LLVM IR で PHI が terminator の後に出現(LLVM invariant 違反)
- Case B (loop_min_while.hako) が TAG-EMIT で失敗
修正:
- Multi-pass block lowering architecture 実装:
- Pass A: non-terminator instructions のみ emit
- Pass B: PHI finalization(block head に確実に配置)
- Pass C: deferred terminators を最後に emit
変更ファイル:
- src/llvm_py/builders/block_lower.py (~40行):
- lower_blocks() で terminator を defer
- lower_terminators() 新設(Pass C)
- _deferred_terminators dict で管理
- src/llvm_py/builders/function_lower.py (3行):
- Pass 順序更新: A→B→C
- src/llvm_py/instructions/ret.py (5行):
- _disable_phi_synthesis flag で Pass C 中の PHI 生成を抑制
テスト結果:
- Case B EMIT: ❌→✅ (修正成功)
- Case B LINK: ❌ (新 TAG-LINK: undefined nyash_console_log)
- Case A/B2: ✅ (退行なし)
箱化モジュール化:
- ✅ Multi-pass で責務分離
- ✅ Flag mechanism で構造的制御
- ✅ ハードコード禁止原則遵守
Next: Phase 131-5 (TAG-LINK 修正)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-14 06:12:31 +09:00 |
|
|
|
5709026812
|
docs(phase131): Phase 131-3 完了 - LLVM lowering 棚卸し(3ケース)
Phase 131-3 完了: MIR→LLVM lowering 棚卸し
テスト結果マトリックス:
- Case A (phase87_llvm_exe_min.hako): ✅ PASS (baseline)
- Case B (loop_min_while.hako): ❌ TAG-EMIT (PHI after terminator)
- Case B2 (print(42) simple): ✅ PASS (BoxCall works)
- Case C (llvm_stage3_loop_only.hako): ❌ TAG-EMIT (JoinIR pattern gap)
Critical Bugs:
1. Bug #1: PHI After Terminator (Case B)
- 原因: function_lower.py が terminator を PHI より先に emit
- 修正: 4-pass block emission (2-3h)
2. Bug #2: JoinIR Pattern Gap (Case C)
- 原因: loop(true) { break } パターンが JoinIR 未対応
- 修正: Pattern 5 設計・実装 (3-4h)
Next Actions:
- P1 (推奨): PHI ordering 修正 → 80% のループを有効化
- P2: JoinIR Pattern 5 → infinite loop 対応
ドキュメント:
- phase131-3-llvm-lowering-inventory.md: 詳細棚卸し結果
- phase87-selfhost-llvm-exe-line.md: LLVM IR parsing error 追記
- CURRENT_TASK.md: phase131-3 参照追加
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-14 05:55:21 +09:00 |
|