feat(vm): execute reference tests and casts for PLN-0176 step 22

This commit is contained in:
2026-10-07 20:36:28 +01:00
parent c7236f1269
commit 1124ac10e7
3 changed files with 205 additions and 8 deletions
@@ -2,6 +2,7 @@ use crate::resource_budget::BudgetVec;
mod dynamic;
mod gc;
mod loader;
mod reference;
mod runtime;
mod stack;
mod typed;
@@ -1365,15 +1366,9 @@ impl VirtualMachine {
return self.execute_dynamic(opcode, target, start_pc as u32);
}
OpCode::RefIsExact | OpCode::RefImplements | OpCode::RefToTrait | OpCode::RefCast => {
// Slot-only ProgramImage cannot authorize typed instructions. The
// v1 image/verifier integration supplies their execution context.
self.cycles += opcode.cycles();
return Err(self.trap(
prometeu_bytecode::TRAP_ILLEGAL_INSTRUCTION,
opcode as u16,
"Instruction requires a validated Program Registry".into(),
start_pc as u32,
));
let (source, target) = instr.imm_u32x2().unwrap();
return self.execute_reference(opcode, source, target, start_pc as u32);
}
OpCode::FrameSync => {
// Marks the logical end of a frame: consume cycles and signal to the driver