feat(phase71-ssa): ParserBox委譲SSA undef完全解消達成!(9件→0件)

**Phase 71-SSA: 全SSA undef完全解消達成!**
- 修正前: trim系 4件 + ParserBox委譲 9件 = 計13件
- 修正後: **0件** (100%解消!)

**修正内容**:
1. ParserBox委譲メソッド削除 (L71-106)
   - 削除: is_digit, is_space, is_alpha, starts_with, index_of
   - 削除: starts_with_kw, i2s, to_int, skip_ws
   - 理由: static box delegation による ValueId mapping 失敗

2. ParserBox内部呼び出し修正 (5箇所)
   - `me.to_int()` → `ParserStringUtilsBox.to_int()`
   - `me.starts_with()` → `ParserStringUtilsBox.starts_with()`
   - L112, L129, L157, L160, L353 を修正

3. compiler_stageb.hako トレース追加 (L1477-1495)
   - Program JSON emit 直前にトレースポイント追加
   - HAKO_STAGEB_TRACE=1 で詳細トレース出力

**根本原因** (Rust MIRビルダーのバグ):
- static box の委譲時に ValueId マッピングが失敗
- 引数の ValueId が undef (未定義) になる
- 例: Copy { dst: ValueId(4), src: ValueId(132) }
  で ValueId(132) が存在しない

**Phase 71-SSA戦略**:
- .hako 層で委譲を廃止 (回避策)
- 直接実装または直接呼び出しに統一
- 根本解決は将来タスク (Rust MIRビルダー修正)

**検証結果**:
```bash
grep -c 'ssa-undef-debug' logs/selfhost/stageb_*.log
# 出力: 0  ← 完全成功!
```

**残存課題**:
- dev verify警告: 1件 (StageBDriverBox birth)
- Program JSON emit: extract_ok=0 (次フェーズで調査)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-02 11:22:53 +09:00
parent 4b3eb6b3a9
commit 29e09c1491
2 changed files with 28 additions and 22 deletions

View File

@ -1474,9 +1474,25 @@ static box StageBDriverBox {
}
}
// Phase 71-SSA 71-11.1: Guaranteed trace before Program JSON emit
{
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
if marker_enabled != null && ("" + marker_enabled) == "1" {
local ajson_len = 0
if ast_json != null { ajson_len = ("" + ast_json).length() }
print("[stageb/main] BEFORE_EMIT ast_json_len=" + ("" + ajson_len))
}
}
print("[stageb/main] before ast_json")
print(ast_json)
print("[stageb/main] after ast_json")
// Phase 71-SSA 71-11.1: Guaranteed trace after Program JSON emit
{
local marker_enabled = env.get("HAKO_STAGEB_TRACE")
if marker_enabled != null && ("" + marker_enabled) == "1" {
print("[stageb/main] AFTER_EMIT success")
}
}
{
local tracer = new StageBTraceBox()
tracer.log("StageBDriverBox.main:exit rc=0")