refactor(mir): Remove CoreContext legacy fields (Phase 2-2/7)
完全移行→削除の安全順序(Option C)に従い、CoreContext の deprecated フィールドと sync helpers を完全削除。 ## Changes - Migrated all access sites to core_ctx.* (SSOT allocators) - utils.rs: value_gen (3 sites), block_gen (1 site), temp_slot_counter (1 site) - loop_api.rs: block_gen (1 site) - phi_helpers.rs: value_gen (1 site) - builder.rs: sync helpers (2 methods), test assertions (2 sites) - Removed 5 deprecated fields from builder.rs - value_gen: ValueIdGenerator - block_gen: BasicBlockIdGenerator - next_binding_id: u32 - temp_slot_counter: u32 - debug_join_counter: u32 - Removed sync helper calls (allocate_binding_id, debug_next_join_id) - Removed field initializations from MirBuilder::new() - Maintained Phase 136 P0 SSOT structure (next_value_id() remains as high-level API) ## Tests - cargo build --release: PASS - cargo test --release --lib: 1029 passed (4 pre-existing failures) - Deprecation warnings: 435 → 456 (+21) Note: Warnings increased due to remaining deprecated field *uses* being exposed after removing the field *definitions*. This is expected during migration. ## Code metrics - Net reduction: 40 lines (-56 removed, +16 modifications) - Files changed: 4 (builder.rs, utils.rs, loop_api.rs, phi_helpers.rs) Phase 2 Progress: 2/7 contexts complete (MetadataContext ✅, CoreContext ✅)
This commit is contained in:
@ -41,10 +41,8 @@ impl super::MirBuilder {
|
||||
let candidate = if let Some(ref mut f) = self.current_function {
|
||||
f.next_value_id() // Function context
|
||||
} else {
|
||||
// Phase 136 Step 2/7: Use core_ctx as SSOT, sync legacy field
|
||||
let id = self.core_ctx.next_value();
|
||||
self.value_gen = self.core_ctx.value_gen.clone();
|
||||
id
|
||||
// Phase 136 Step 2/7 + Phase 2-2: Use core_ctx as SSOT (no sync needed)
|
||||
self.core_ctx.next_value()
|
||||
};
|
||||
|
||||
// Phase 201-A: Skip reserved PHI dst ValueIds
|
||||
@ -60,13 +58,10 @@ impl super::MirBuilder {
|
||||
|
||||
/// Allocate a new BasicBlockId
|
||||
///
|
||||
/// Phase 136 Step 2/7: Uses core_ctx as SSOT, syncs legacy field.
|
||||
/// Phase 136 Step 2/7 + Phase 2-2: Uses core_ctx as SSOT (no sync needed).
|
||||
#[inline]
|
||||
#[allow(deprecated)]
|
||||
pub(crate) fn next_block_id(&mut self) -> super::BasicBlockId {
|
||||
let id = self.core_ctx.next_block();
|
||||
self.block_gen = self.core_ctx.block_gen.clone();
|
||||
id
|
||||
self.core_ctx.next_block()
|
||||
}
|
||||
|
||||
// ---- LocalSSA convenience (readability helpers) ----
|
||||
@ -442,13 +437,13 @@ impl super::MirBuilder {
|
||||
v: super::ValueId,
|
||||
hint: &str,
|
||||
) -> Result<super::ValueId, String> {
|
||||
self.temp_slot_counter = self.temp_slot_counter.wrapping_add(1);
|
||||
let slot_name = format!("__pin${}${}", self.temp_slot_counter, hint);
|
||||
let slot_id = self.core_ctx.next_temp_slot();
|
||||
let slot_name = format!("__pin${}${}", slot_id, hint);
|
||||
// Phase 25.1b: Use function-local ID allocator to avoid SSA verification failures
|
||||
let dst = if let Some(ref mut f) = self.current_function {
|
||||
f.next_value_id() // Function context: use local ID
|
||||
} else {
|
||||
self.value_gen.next() // Module context: use global ID
|
||||
self.core_ctx.next_value() // Module context: use core_ctx SSOT
|
||||
};
|
||||
self.emit_instruction(super::MirInstruction::Copy { dst, src: v })?;
|
||||
if super::utils::builder_debug_enabled()
|
||||
@ -479,7 +474,7 @@ impl super::MirBuilder {
|
||||
let dst = if let Some(ref mut f) = self.current_function {
|
||||
f.next_value_id() // Function context: use local ID
|
||||
} else {
|
||||
self.value_gen.next() // Module context: use global ID
|
||||
self.core_ctx.next_value() // Module context: use core_ctx SSOT
|
||||
};
|
||||
self.emit_instruction(super::MirInstruction::Copy { dst, src: v })?;
|
||||
// Propagate metadata (type/origin) from source to the new local copy
|
||||
|
||||
Reference in New Issue
Block a user