feat(mir): Phase 136 Step 2/7 - CoreContext extraction complete
Extract core ID generation fields from MirBuilder to improve organization: - value_gen: ValueIdGenerator - block_gen: BasicBlockIdGenerator - next_binding_id: u32 (Phase 74) - temp_slot_counter: u32 - debug_join_counter: u32 Implementation: - Created src/mir/builder/core_context.rs (215 lines) - Added core_ctx field to MirBuilder as SSOT - Deprecated legacy fields with backward compat - ID allocation methods use core_ctx and sync legacy fields - Added next_block_id() helper, replaced 30+ block_gen.next() calls Testing: - cargo build --release: SUCCESS (193 warnings expected) - cargo test --release --lib: 1004/1004 PASS (+7 tests) - phase135_trim_mir_verify.sh: PASS - phase132_exit_phi_parity.sh: 3/3 PASS Progress: 2/7 Context extractions complete (TypeContext + CoreContext) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -32,14 +32,14 @@ pub(in crate::mir::builder) fn cf_try_catch(
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
let try_block = builder.block_gen.next();
|
||||
let catch_block = builder.block_gen.next();
|
||||
let try_block = builder.next_block_id();
|
||||
let catch_block = builder.next_block_id();
|
||||
let finally_block = if finally_body.is_some() {
|
||||
Some(builder.block_gen.next())
|
||||
Some(builder.next_block_id())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let exit_block = builder.block_gen.next();
|
||||
let exit_block = builder.next_block_id();
|
||||
|
||||
// Snapshot deferred-return state
|
||||
let saved_defer_active = builder.return_defer_active;
|
||||
|
||||
@ -23,7 +23,7 @@ pub(super) fn allocate_blocks(
|
||||
|
||||
// Phase 177-3: Allocate exit block FIRST to ensure it doesn't conflict with JoinIR blocks
|
||||
// This exit_block_id will be returned and used by instruction_rewriter and exit_phi_builder
|
||||
let exit_block_id = builder.block_gen.next();
|
||||
let exit_block_id = builder.next_block_id();
|
||||
|
||||
eprintln!(
|
||||
"[cf_loop/joinir/block_allocator] Phase 177-3: Allocated exit_block_id = {:?}",
|
||||
@ -49,7 +49,7 @@ pub(super) fn allocate_blocks(
|
||||
blocks.sort_by_key(|(id, _)| id.0);
|
||||
|
||||
for (old_block_id, _) in blocks {
|
||||
let new_block_id = builder.block_gen.next();
|
||||
let new_block_id = builder.next_block_id();
|
||||
// Use remapper to store composite key mapping
|
||||
remapper.set_block(func_name.clone(), *old_block_id, new_block_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user