fix(normalization): Phase 143 execution fix - Param region SSOT
Problem: normalized_helpers allocated env params as ValueId(1,2...) in PHI Reserved region (0-99) instead of Param region (100-999) per JoinValueSpace contract. Root cause: All 4 normalized shadow modules started from next_value_id=1, violating the Param region contract. Solution: - Add NormalizedHelperBox::alloc_env_params_param_region() that allocates params starting from PARAM_MIN (100) - Update 4 normalized shadow files to use new API: - loop_true_if_break_continue.rs - loop_true_break_once.rs - if_as_last_join_k.rs - post_if_post_k.rs - Fix instruction_rewriter.rs type mismatch (func.signature.params → func.params) Verification: - Unit tests: 69/69 PASS - VM smoke: exit code 7 ✅ - LLVM EXE smoke: exit code 7 ✅ (timeout resolved!) ValueId Space Contract (Phase 201): | Region | Range | Purpose | |--------------|----------|------------------------------| | PHI Reserved | 0-99 | Loop header PHI dst | | Param | 100-999 | env params (flag, counter) | | Local | 1000+ | Const, BinOp, condition | 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -992,11 +992,18 @@ pub(super) fn merge_and_rewrite(
|
||||
if let Some(boundary) = boundary {
|
||||
use crate::mir::builder::joinir_inline_boundary_injector::BoundaryInjector;
|
||||
|
||||
// Get entry function's entry block (first function by convention)
|
||||
// Get entry function's entry block.
|
||||
//
|
||||
// Phase 143 fix: Normalized shadow fragments emit multiple helper functions
|
||||
// (e.g. condition_fn) whose names may sort before the true entry.
|
||||
// Choosing `.iter().next()` can therefore pick the wrong function and skip
|
||||
// host→JoinIR Copy injection. Instead, pick the function whose params match
|
||||
// the boundary.join_inputs (the entry env params).
|
||||
let (entry_func_name, entry_func) = mir_module
|
||||
.functions
|
||||
.iter()
|
||||
.next()
|
||||
.find(|(_, func)| func.params == boundary.join_inputs)
|
||||
.or_else(|| mir_module.functions.iter().next())
|
||||
.ok_or("JoinIR module has no functions")?;
|
||||
let entry_block_remapped = remapper
|
||||
.get_block(entry_func_name, entry_func.entry_block)
|
||||
|
||||
Reference in New Issue
Block a user