feat(mir): Phase 136 P0 - ValueId allocator SSOT 徹底(関数内経路から value_gen.next() 掃討)
## Summary
Eliminates remaining `value_gen.next()` calls from function-context code paths,
unifying all ValueId allocation through `MirBuilder::next_value_id()` SSOT allocator.
## Changes
### 1. Fixed `new_typed_value()` (src/mir/builder.rs:1068)
**Before**: `let id = self.value_gen.next();` (bypasses function context)
**After**: `let id = self.next_value_id();` (respects function context)
This is a public API used in function context, so must use SSOT allocator
to avoid collisions with reserved PHI dsts and function params.
### 2. Fixed test code (src/mir/builder.rs)
**test_shadowing_binding_restore** (lines 1161, 1171):
- Simulates function scope with `push_lexical_scope()`
- Changed to `builder.next_value_id()` for function scope simulation
**test_valueid_binding_parallel_allocation** (lines 1196-1216):
- Tests ValueId/BindingId independence
- Changed to `builder.next_value_id()` with note that Module context fallback preserves test intent
### 3. Verified Module context fallbacks (OK, no change needed)
These already check `current_function.is_some()` and use `value_gen.next()` only as Module context fallback:
- `src/mir/builder/utils.rs:43` - next_value_id() SSOT implementation
- `src/mir/builder/utils.rs:436` - pin_to_slot()
- `src/mir/builder/utils.rs:467` - materialize_local()
- `src/mir/utils/phi_helpers.rs:69` - insert_phi_unified()
## Verification
```bash
rg -n "value_gen\.next\(" src/mir --type rust | grep -v "Module context" | grep -v "//"
# Result: Only comments/docs remain
```
## Acceptance
✅ cargo test --release --lib - 997 passed
✅ phase135_trim_mir_verify.sh - PASS
✅ phase132_exit_phi_parity.sh - 3/3 PASS
✅ All function-context `value_gen.next()` eliminated
## Effect
- **Collision prevention**: No more ValueId collisions between function-level allocations and reserved PHI dsts
- **SSOT compliance**: All ValueId allocation flows through single allocator
- **Contract enforcement**: Phase 135 P1 contract_checks will catch violations immediately
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
- **Phase 133**: Promoted carrier join_id(Trim)修正
|
||||
- **Phase 134**: Plugin loader best-effort loading
|
||||
- **Phase 135**: ConditionLoweringBox allocator SSOT(ValueId 衝突の根治)
|
||||
- **Phase 136**: ValueId allocator SSOT 徹底(残存 value_gen.next() 掃討)
|
||||
|
||||
## Phase フォルダ構成(推奨)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user