feat(llvm): Phase 131-11-H/12 - ループキャリアPHI型修正 & vmap snapshot SSOT

## Phase 131-11-H: ループキャリアPHI型修正
- PHI生成時に初期値(entry block)の型のみ使用
- backedge の値を型推論に使わない(循環依存回避)
- NYASH_CARRIER_PHI_DEBUG=1 でトレース

## Phase 131-12-P0: def_blocks 登録 & STRICT エラー化
- safe_vmap_write() で PHI 上書き保護
- resolver miss を STRICT でエラー化(フォールバック 0 禁止)
- def_blocks 自動登録

## Phase 131-12-P1: vmap_cur スナップショット実装
- DeferredTerminator 構造体(block, term_ops, vmap_snapshot)
- Pass A で vmap_cur をスナップショット
- Pass C でスナップショット復元(try-finally)
- STRICT モード assert

## 結果
-  MIR PHI型: Integer(正しい)
-  VM: Result: 3
-  vmap snapshot 機構: 動作確認
- ⚠️ LLVM: Result: 0(別のバグ、次Phase で調査)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-14 21:28:41 +09:00
parent 413504d6de
commit 7dfd6ff1d9
21 changed files with 1391 additions and 133 deletions

View File

@ -1,7 +1,7 @@
# Phase 131-11: Case C 本命タスク - 調査完了レポート
**Date**: 2025-12-14
**Status**: ✅ Root Cause Analysis Complete - Ready for Implementation
**Status**: Active - Pattern detection landed; follow-ups tracked
---
@ -11,6 +11,16 @@
**Test File**: `apps/tests/llvm_stage3_loop_only.hako`
## 状態アップデートPhase 131-11 AC / H
- Phase 131-11 AC: `loop(true)` + break/continue を専用パターン(`pattern5_infinite_early_exit.rs`)へルーティングできる状態まで到達(検出/shape guard
- Phase 131-11 H: ループキャリアPHIの型が循環で壊れる問題に対して、PHI作成時に entry(init) 側の型のみを seed する修正が入った。
- 参考(原因レポート): `docs/development/current/main/phase-131-11-g-phi-type-bug-report.md`
- PHI/型デバッグ: `docs/reference/environment-variables.md``NYASH_PHI_TYPE_DEBUG` / `NYASH_PHI_META_DEBUG`
現状メモ:
- VM では期待値に一致するが、LLVM では結果が一致しないケースが残っている(別トピックとして棚卸し/切り分けが必要)。
---
## 🔍 Root Cause (完全解明済み)