minor changes

This commit is contained in:
2026-04-20 15:28:51 +08:00
parent 520bb7d75e
commit 581c333070
3 changed files with 7 additions and 8 deletions
+1 -2
View File
@@ -288,8 +288,7 @@ pub(crate) fn run_tailcall<'gc, C: VmContext>(
bc: &[u8],
pc: u32,
) -> TailResult {
const FUEL: u32 = 1024;
let table = &DispatchTable::<'gc, C>::NEW;
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
View File
@@ -143,6 +143,7 @@ pub struct Vm<'gc> {
pub(crate) stack: Vec<Value<'gc>>,
pub(crate) call_stack: Vec<CallFrame<'gc>>,
pub(crate) call_depth: usize,
#[allow(dead_code)]
#[collect(require_static)]
pub(crate) error_context: Vec<ErrorFrame>,
@@ -332,10 +333,7 @@ impl<'gc> Vm<'gc> {
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Option<StepResult> {
let val = self.peek_stack(depth);
let Some(thunk) = val.as_gc::<Thunk>() else {
return None;
};
let thunk = self.peek_stack(depth).as_gc::<Thunk>()?;
let mut state = thunk.borrow_mut(mc);
match *state {
ThunkState::Pending { ip, env, with_env } => {
@@ -425,6 +423,8 @@ impl Vm<'_> {
}
impl<'gc> Vm<'gc> {
const DEFAULT_FUEL_AMOUNT: u32 = 1024;
#[inline(always)]
fn dispatch_batch<C: VmContext>(
&mut self,
@@ -461,10 +461,9 @@ impl<'gc> Vm<'gc> {
mc: &Mutation<'gc>,
) -> Action {
use fix_codegen::Op::*;
const DEFAULT_FUEL_AMOUNT: usize = 1024;
let mut reader = BytecodeReader::new(bytecode, pc);
let mut fuel = DEFAULT_FUEL_AMOUNT;
let mut fuel = Self::DEFAULT_FUEL_AMOUNT;
loop {
if fuel == 0 {
+1
View File
@@ -28,6 +28,7 @@ mod private {
pub unsafe trait Storable: private::Cealed {
const TAG: (bool, u8);
}
#[allow(private_bounds)]
pub trait InlineStorable: Storable + RawStore {}
pub trait GcStorable: Storable {}