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

@ -0,0 +1,29 @@
// Phase 132-P2: Multi-function context isolation test
// Tests that FunctionLowerContext properly isolates per-function state
//
// This creates two separate methods with independent loops to verify
// that each function's context is cleaned up between calls.
static box Main {
helper1(n) {
local i = 0
loop(i < n) {
i = i + 1
}
return i
}
helper2(n) {
local j = 0
loop(j < n) {
j = j + 1
}
return j
}
main() {
local a = helper1(2)
local b = helper2(3)
return a + b
}
}