feat(vm): execute Dynamic instructions and exact costs for PLN-0176 step 21

This commit is contained in:
2026-10-07 20:34:11 +01:00
parent ba603ce64a
commit c7236f1269
3 changed files with 272 additions and 7 deletions
@@ -1,4 +1,5 @@
use crate::resource_budget::BudgetVec;
mod dynamic;
mod gc;
mod loader;
mod runtime;
@@ -1358,13 +1359,12 @@ impl VirtualMachine {
self.push_trap(value, opcode, start_pc as u32)?;
}
}
OpCode::DynPack
| OpCode::DynUnpack
| OpCode::DynCanUnpack
| OpCode::RefIsExact
| OpCode::RefImplements
| OpCode::RefToTrait
| OpCode::RefCast => {
OpCode::DynPack | OpCode::DynUnpack | OpCode::DynCanUnpack => {
self.cycles += opcode.cycles();
let target = instr.imm_u32().unwrap();
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();