better force eval ergonomic

This commit is contained in:
2026-04-21 22:05:49 +08:00
parent b31c2a4906
commit e469d1b819
7 changed files with 303 additions and 123 deletions
+2 -2
View File
@@ -1,6 +1,7 @@
use fix_error::Error;
use gc_arena::{Gc, Mutation, RefLock};
use crate::value::*;
use crate::{BytecodeReader, CallFrame, Closure, Env, Step, ThunkState, VmContextExt};
impl<'gc> crate::Vm<'gc> {
@@ -11,12 +12,11 @@ impl<'gc> crate::Vm<'gc> {
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> Step {
self.try_force(0, reader, mc)?;
let func = self.try_force::<StrictValue>(reader, mc)?;
if self.call_depth > 10000 {
return self.finish_err(Error::eval_error("stack overflow; max-call-depth exceeded"));
}
self.call_depth += 1;
let func = self.pop();
let arg = reader.read_operand_data(ctx).resolve(mc, self);
if let Some(closure) = func.as_gc::<Closure>() {
let ip = closure.ip;