Phase 25.1b: VM undefined-value diagnostics and builder SSA helpers

This commit is contained in:
nyash-codex
2025-11-17 03:19:03 +09:00
parent 4b078e6df9
commit 82b6c4e834
12 changed files with 231 additions and 41 deletions

View File

@ -29,8 +29,9 @@ impl MirInterpreter {
.map(|k| format!("{:?}", k))
.collect();
eprintln!(
"[vm-trace] reg_load undefined id={:?} last_block={:?} last_inst={:?} regs={}",
"[vm-trace] reg_load undefined id={:?} fn={} last_block={:?} last_inst={:?} regs={}",
id,
self.cur_fn.as_deref().unwrap_or("<unknown>"),
self.last_block,
self.last_inst,
keys.join(", ")
@ -43,9 +44,13 @@ impl MirInterpreter {
if tolerate {
return Ok(VMValue::Void);
}
let fn_name = self.cur_fn.as_deref().unwrap_or("<unknown>");
Err(VMError::InvalidValue(format!(
"use of undefined value {:?}",
id
"use of undefined value {:?} (fn={}, last_block={:?}, last_inst={:?})",
id,
fn_name,
self.last_block,
self.last_inst,
)))
}
}