完全移行→削除の安全順序(Option C)に従い、TypeContext の deprecated フィールドと sync helpers を完全削除。 ⚠️ 危険ゾーン: TypeFactsBox 等の同名フィールドと混同しないよう、 ファイル単位で手作業移行を実施。 ## Changes - Migrated all MirBuilder access sites to type_ctx.* (manual, 40+ files) - Removed 3 deprecated fields (value_types, value_kinds, value_origin_newbox) - Removed 2 sync helpers (sync_type_ctx_to_legacy, sync_legacy_to_type_ctx) - Verified TypeFactsBox, CalleeGuardBox unchanged (no false positives) ## Tests - cargo test --release --lib: 1029/1033 PASS - TypeFactsBox integration: PASS (borrowed references unchanged) - Deprecation warnings: 456 → 255 (-201, -44%) ## Safety Verification ✅ TypeFactsBox unchanged (still uses &'a BTreeMap borrowed references) ✅ CalleeGuardBox unchanged ✅ CalleeResolverBox unchanged ✅ BoxCompilationContext unchanged Phase 2 Progress: 3/7 contexts complete (43%) - ✅ MetadataContext - ✅ CoreContext - ✅ TypeContext (this commit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
use super::super::{BasicBlockId, MirBuilder, ValueId};
|
||
|
||
/// Emit a dev‑only JSONL event for a PHI decision.
|
||
/// Computes predecessor meta(type/origin)from the builder’s current maps.
|
||
pub(crate) fn emit_phi(builder: &MirBuilder, dst: ValueId, inputs: &Vec<(BasicBlockId, ValueId)>) {
|
||
// Respect env gates in hub; just build meta here.
|
||
let preds: Vec<serde_json::Value> = inputs
|
||
.iter()
|
||
.map(|(bb, v)| {
|
||
let t = builder.type_ctx.value_types.get(v).cloned();
|
||
let o = builder.type_ctx.value_origin_newbox.get(v).cloned();
|
||
serde_json::json!({
|
||
"bb": bb.0,
|
||
"v": v.0,
|
||
"type": t.as_ref().map(|tt| format!("{:?}", tt)).unwrap_or_default(),
|
||
"origin": o.unwrap_or_default(),
|
||
})
|
||
})
|
||
.collect();
|
||
let decided_t = builder
|
||
.type_ctx.value_types
|
||
.get(&dst)
|
||
.cloned()
|
||
.map(|tt| format!("{:?}", tt))
|
||
.unwrap_or_default();
|
||
let decided_o = builder
|
||
.type_ctx.value_origin_newbox
|
||
.get(&dst)
|
||
.cloned()
|
||
.unwrap_or_default();
|
||
let meta = serde_json::json!({
|
||
"dst": dst.0,
|
||
"preds": preds,
|
||
"decided_type": decided_t,
|
||
"decided_origin": decided_o,
|
||
});
|
||
let fn_name = builder
|
||
.current_function
|
||
.as_ref()
|
||
.map(|f| f.signature.name.as_str());
|
||
let region = builder.debug_current_region_id();
|
||
crate::debug::hub::emit("ssa", "phi", fn_name, region.as_deref(), meta);
|
||
}
|