refactor(joinir): Phase 286 P1-P3 - Boundary contract context enrichment
- P1: Add alloc_join_param()/alloc_join_local() API to JoinValueSpace - Prevents future API misuse (thin wrappers with explicit "JoinIR" context) - Updated docs with footnote-style number references - P2: Enrich error context with host_fn for better diagnostics - Added context: &str parameter to verify_boundary_contract_at_creation() - Error format now shows: [merge_joinir_mir_blocks host=<fn> ...] - P3: Add join-side info to error context (continuation count + boundary summary) - Uses boundary.continuation_func_ids.len() for join= - Adds [conts=X exits=Y conds=Z] suffix with fixed key names - Enables faster debugging with log-searchable format Error format: [merge_joinir_mir_blocks host=X join=Y [conts=A exits=B conds=C]] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -295,7 +295,6 @@ pub(crate) fn lower(
|
||||
};
|
||||
|
||||
let mut join_value_space = JoinValueSpace::new();
|
||||
let mut alloc_value = || join_value_space.alloc_local();
|
||||
|
||||
let mut join_module = JoinModule::new();
|
||||
|
||||
@ -305,19 +304,25 @@ pub(crate) fn lower(
|
||||
let k_exit_id = JoinFuncId::new(2);
|
||||
|
||||
// ValueId allocation
|
||||
// main() locals
|
||||
let counter_init = alloc_value(); // ValueId(1000) - initial counter
|
||||
let loop_result = alloc_value(); // ValueId(1001) - result from loop_step
|
||||
// Phase 286 P1: Use alloc_param() for function parameters (Param region: 100-999)
|
||||
// Use alloc_local() for local variables (Local region: 1000+)
|
||||
|
||||
// loop_step locals
|
||||
let counter_param = alloc_value(); // ValueId(1002) - parameter
|
||||
let const_1 = alloc_value(); // ValueId(1003) - increment constant
|
||||
let counter_next = alloc_value(); // ValueId(1004) - counter + 1
|
||||
let const_limit = alloc_value(); // ValueId(1005) - limit constant
|
||||
let break_cond = alloc_value(); // ValueId(1006) - counter_next == LIMIT
|
||||
// main() params/locals
|
||||
let counter_init = join_value_space.alloc_param(); // ValueId(100) - initial counter (PARAM)
|
||||
let loop_result = join_value_space.alloc_local(); // ValueId(1000) - result from loop_step (LOCAL)
|
||||
|
||||
// k_exit locals
|
||||
let counter_exit = alloc_value(); // ValueId(1007) - exit parameter
|
||||
// loop_step params/locals
|
||||
let counter_param = join_value_space.alloc_param(); // ValueId(101) - parameter (PARAM)
|
||||
let const_1 = join_value_space.alloc_local(); // ValueId(1001) - increment constant (LOCAL)
|
||||
let counter_next = join_value_space.alloc_local(); // ValueId(1002) - counter + 1 (LOCAL)
|
||||
let const_limit = join_value_space.alloc_local(); // ValueId(1003) - limit constant (LOCAL)
|
||||
let break_cond = join_value_space.alloc_local(); // ValueId(1004) - counter_next == LIMIT (LOCAL)
|
||||
|
||||
// k_exit params/locals
|
||||
let counter_exit = join_value_space.alloc_param(); // ValueId(102) - exit parameter (PARAM)
|
||||
|
||||
// return 0 constant
|
||||
let const_0 = join_value_space.alloc_local(); // Local constant (LOCAL region)
|
||||
|
||||
// ==================================================================
|
||||
// main() function
|
||||
@ -333,7 +338,6 @@ pub(crate) fn lower(
|
||||
});
|
||||
|
||||
// return 0 (Pattern 5 doesn't produce a value, but we return 0 by convention)
|
||||
let const_0 = alloc_value();
|
||||
main_func.body.push(JoinInst::Compute(MirLikeInst::Const {
|
||||
dst: const_0,
|
||||
value: ConstValue::Integer(0),
|
||||
|
||||
Reference in New Issue
Block a user