feat(llvm): Phase 132-P2 - Dict ctx removal (FunctionLowerContext SSOT completion)

Completed SSOT unification for FunctionLowerContext by removing the manual
dict ctx creation and assignment in function_lower.py.

Changes:
- Removed builder.ctx = dict(...) creation (18 lines, lines 313-330)
- Removed builder.resolver.ctx assignment (no longer needed)
- Confirmed instruction_lower.py uses context=owner.context throughout
- Added phase132_multifunc_isolation_min.hako test for multi-function isolation
- Extended phase132_exit_phi_parity.sh with Case C (Rust VM context test)

Testing:
- Phase 132 smoke test: All 3 cases PASS
- Phase 87 LLVM exe test: PASS (Result: 42)
- STRICT mode: PASS
- No regressions: Behavior identical before/after (RC:6 maintained)

Impact:
- Reduced manual context management complexity
- FunctionLowerContext now sole source of truth (SSOT)
- Per-function state properly isolated, no cross-function collisions
- Cleaner architecture: context parameter passed explicitly vs manual dict

🤖 Generated with Claude Code
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-15 12:12:54 +09:00
parent a15d1e97e6
commit aad01a1079
4 changed files with 70 additions and 21 deletions

View File

@ -129,5 +129,20 @@ tuple-key の小手先ではなく **構造で根治**するために、関数
- resolver cachesi64/ptr/f64/end_i64 など)
狙い:
- 関数単位で state を自動破棄し、cross-function collision を 起こせない構造 にする
- 関数単位で state を自動破棄し、cross-function collision を "起こせない構造" にする
- 追加の手動クリアや tuple-key を不要にする
### Phase 132-P2 Follow-up: Dict ctx Cleanup
完成: SSOT 統一を完全化するため、`src/llvm_py/builders/function_lower.py`
`builder.ctx = dict(...)` を削除し、FunctionLowerContext への統一を完成させた。
- 削除: lines 313-330dict ctx の作成と `builder.resolver.ctx` の割り当て)
- 入口: `instruction_lower.py` の全ハンドラが既に `context=owner.context` で呼び出されているため、
manual ctx dict は不要
- テスト追加: `phase132_multifunc_isolation_min.hako`f(2) + f(3) = 5 を exit code で検証)
**状態**:
- ✅ Dict ctx 削除
- ✅ Instruction handlers は `context=owner.context` で統一
- ✅ Multi-function isolation test Case C 追加smoke test phase132_exit_phi_parity.sh