refactor: abstract VM

This commit is contained in:
2026-05-13 18:28:18 +08:00
parent 21899f7380
commit 29fab93cd1
42 changed files with 1823 additions and 1410 deletions
+12 -2
View File
@@ -1,8 +1,8 @@
use fix_abstract_vm::{resolve_operand, *};
use fix_builtins::PrimOpPhase;
use fix_error::Error;
use gc_arena::{Gc, Mutation, RefLock};
use crate::value::*;
use crate::{
BytecodeReader, CallFrame, Closure, Env, ForceMode, Step, ThunkState, VmRuntimeCtx,
VmRuntimeCtxExt,
@@ -120,7 +120,7 @@ impl<'gc> crate::Vm<'gc> {
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Step {
let arg = reader.read_operand_data(ctx).resolve(mc, self);
let arg = resolve_operand(&reader.read_operand_data(ctx), mc, self);
let pc = reader.pc();
self.call(reader, mc, arg, pc)
}
@@ -170,4 +170,14 @@ impl<'gc> crate::Vm<'gc> {
self.env = env;
Step::Continue(())
}
#[inline(always)]
pub(crate) fn op_dispatch_primop(
&mut self,
ctx: &mut impl VmRuntimeCtx,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Step {
fix_primops::dispatch_primop(self, ctx, reader, mc)
}
}