minor changes
This commit is contained in:
@@ -288,8 +288,7 @@ pub(crate) fn run_tailcall<'gc, C: VmContext>(
|
|||||||
bc: &[u8],
|
bc: &[u8],
|
||||||
pc: u32,
|
pc: u32,
|
||||||
) -> TailResult {
|
) -> TailResult {
|
||||||
const FUEL: u32 = 1024;
|
|
||||||
let table = &DispatchTable::<'gc, C>::NEW;
|
let table = &DispatchTable::<'gc, C>::NEW;
|
||||||
let op = bc[pc as usize] as usize;
|
let op = bc[pc as usize] as usize;
|
||||||
table.0[op](vm, mc, ctx, bc, table, pc, FUEL)
|
table.0[op](vm, mc, ctx, bc, table, pc, Vm::DEFAULT_FUEL_AMOUNT)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -143,6 +143,7 @@ pub struct Vm<'gc> {
|
|||||||
pub(crate) stack: Vec<Value<'gc>>,
|
pub(crate) stack: Vec<Value<'gc>>,
|
||||||
pub(crate) call_stack: Vec<CallFrame<'gc>>,
|
pub(crate) call_stack: Vec<CallFrame<'gc>>,
|
||||||
pub(crate) call_depth: usize,
|
pub(crate) call_depth: usize,
|
||||||
|
#[allow(dead_code)]
|
||||||
#[collect(require_static)]
|
#[collect(require_static)]
|
||||||
pub(crate) error_context: Vec<ErrorFrame>,
|
pub(crate) error_context: Vec<ErrorFrame>,
|
||||||
|
|
||||||
@@ -332,10 +333,7 @@ impl<'gc> Vm<'gc> {
|
|||||||
reader: &mut BytecodeReader<'_>,
|
reader: &mut BytecodeReader<'_>,
|
||||||
mc: &Mutation<'gc>,
|
mc: &Mutation<'gc>,
|
||||||
) -> Option<StepResult> {
|
) -> Option<StepResult> {
|
||||||
let val = self.peek_stack(depth);
|
let thunk = self.peek_stack(depth).as_gc::<Thunk>()?;
|
||||||
let Some(thunk) = val.as_gc::<Thunk>() else {
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
let mut state = thunk.borrow_mut(mc);
|
let mut state = thunk.borrow_mut(mc);
|
||||||
match *state {
|
match *state {
|
||||||
ThunkState::Pending { ip, env, with_env } => {
|
ThunkState::Pending { ip, env, with_env } => {
|
||||||
@@ -425,6 +423,8 @@ impl Vm<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'gc> Vm<'gc> {
|
impl<'gc> Vm<'gc> {
|
||||||
|
const DEFAULT_FUEL_AMOUNT: u32 = 1024;
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn dispatch_batch<C: VmContext>(
|
fn dispatch_batch<C: VmContext>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -461,10 +461,9 @@ impl<'gc> Vm<'gc> {
|
|||||||
mc: &Mutation<'gc>,
|
mc: &Mutation<'gc>,
|
||||||
) -> Action {
|
) -> Action {
|
||||||
use fix_codegen::Op::*;
|
use fix_codegen::Op::*;
|
||||||
const DEFAULT_FUEL_AMOUNT: usize = 1024;
|
|
||||||
|
|
||||||
let mut reader = BytecodeReader::new(bytecode, pc);
|
let mut reader = BytecodeReader::new(bytecode, pc);
|
||||||
let mut fuel = DEFAULT_FUEL_AMOUNT;
|
let mut fuel = Self::DEFAULT_FUEL_AMOUNT;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if fuel == 0 {
|
if fuel == 0 {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ mod private {
|
|||||||
pub unsafe trait Storable: private::Cealed {
|
pub unsafe trait Storable: private::Cealed {
|
||||||
const TAG: (bool, u8);
|
const TAG: (bool, u8);
|
||||||
}
|
}
|
||||||
|
#[allow(private_bounds)]
|
||||||
pub trait InlineStorable: Storable + RawStore {}
|
pub trait InlineStorable: Storable + RawStore {}
|
||||||
pub trait GcStorable: Storable {}
|
pub trait GcStorable: Storable {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user