refactor: split VmContext

This commit is contained in:
2026-04-25 17:54:59 +08:00
parent 468269c20d
commit 4f3cd0ef4c
9 changed files with 243 additions and 215 deletions
+6 -4
View File
@@ -2,13 +2,15 @@ use fix_error::Error;
use gc_arena::{Gc, Mutation, RefLock};
use crate::value::*;
use crate::{BytecodeReader, CallFrame, Closure, Env, Step, ThunkState, VmContextExt};
use crate::{
BytecodeReader, CallFrame, Closure, Env, Step, ThunkState, VmRuntimeCtx, VmRuntimeCtxExt,
};
impl<'gc> crate::Vm<'gc> {
#[inline(always)]
pub(crate) fn op_call(
&mut self,
ctx: &mut impl crate::VmContext,
ctx: &mut impl VmRuntimeCtx,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Step {
@@ -45,14 +47,14 @@ impl<'gc> crate::Vm<'gc> {
#[inline(always)]
pub(crate) fn op_return(
&mut self,
ctx: &mut impl crate::VmContext,
ctx: &mut impl VmRuntimeCtx,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Step {
self.handle_return(reader, ctx, mc)
}
pub(crate) fn handle_return<C: crate::VmContext>(
pub(crate) fn handle_return<C: VmRuntimeCtx>(
&mut self,
reader: &mut BytecodeReader<'_>,
ctx: &C,