refactor: split VmContext
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
use gc_arena::Mutation;
|
||||
|
||||
use crate::{Break, BytecodeReader, Step, Vm, VmContext};
|
||||
use crate::{Break, BytecodeReader, Step, Vm, VmRuntimeCtx};
|
||||
|
||||
pub(crate) enum TailResult {
|
||||
YieldFuel(u32),
|
||||
@@ -19,9 +19,9 @@ pub(crate) type OpFn<'gc, C> = extern "rust-preserve-none" fn(
|
||||
u32,
|
||||
) -> TailResult;
|
||||
|
||||
pub(crate) struct DispatchTable<'gc, C: VmContext>(pub(crate) [OpFn<'gc, C>; 256]);
|
||||
pub(crate) struct DispatchTable<'gc, C: VmRuntimeCtx>(pub(crate) [OpFn<'gc, C>; 256]);
|
||||
|
||||
extern "rust-preserve-none" fn op_illegal<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn op_illegal<'gc, C: VmRuntimeCtx>(
|
||||
_vm: &mut Vm<'gc>,
|
||||
_mc: &Mutation<'gc>,
|
||||
_ctx: &mut C,
|
||||
@@ -50,7 +50,7 @@ macro_rules! tail_dispatch_after {
|
||||
|
||||
macro_rules! tail_fn {
|
||||
($name:ident, ()) => {
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
@@ -64,7 +64,7 @@ macro_rules! tail_fn {
|
||||
}
|
||||
};
|
||||
($name:ident, (reader)) => {
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
@@ -79,7 +79,7 @@ macro_rules! tail_fn {
|
||||
}
|
||||
};
|
||||
($name:ident, (reader, mc)) => {
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
@@ -94,7 +94,7 @@ macro_rules! tail_fn {
|
||||
}
|
||||
};
|
||||
($name:ident, (ctx, reader, mc)) => {
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
@@ -109,7 +109,7 @@ macro_rules! tail_fn {
|
||||
}
|
||||
};
|
||||
($name:ident, (ctx)) => {
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmContext>(
|
||||
extern "rust-preserve-none" fn $name<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
@@ -198,7 +198,7 @@ tail_fn!(op_load_scoped_binding, (reader));
|
||||
|
||||
macro_rules! table {
|
||||
($($variant:ident => $fn:ident),* $(,)?) => {
|
||||
impl<'gc, C: VmContext> DispatchTable<'gc, C> {
|
||||
impl<'gc, C: VmRuntimeCtx> DispatchTable<'gc, C> {
|
||||
pub(crate) const NEW: Self = {
|
||||
let mut arr: [OpFn<'gc, C>; 256] = [op_illegal; 256];
|
||||
$( arr[fix_codegen::Op::$variant as usize] = $fn; )*
|
||||
@@ -291,7 +291,7 @@ table! {
|
||||
Illegal => op_illegal,
|
||||
}
|
||||
|
||||
pub(crate) fn run_tailcall<'gc, C: VmContext>(
|
||||
pub(crate) fn run_tailcall<'gc, C: VmRuntimeCtx>(
|
||||
vm: &mut Vm<'gc>,
|
||||
mc: &Mutation<'gc>,
|
||||
ctx: &mut C,
|
||||
|
||||
Reference in New Issue
Block a user