optimize(env): single arg

This commit is contained in:
2025-05-20 09:47:30 +08:00
parent b4db46d48a
commit d0298ce2a6
8 changed files with 76 additions and 38 deletions

View File

@@ -485,7 +485,7 @@ pub struct Thunk<'jit, 'vm> {
#[derive(Debug, IsVariant, Unwrap, Clone)]
pub enum _Thunk<'jit, 'vm> {
Code(&'vm OpCodes, OnceCell<LetEnv<'jit, 'vm>>),
Code(&'vm OpCodes, OnceCell<Rc<LetEnv<'jit, 'vm>>>),
SuspendedFrom(*const Thunk<'jit, 'vm>),
Value(Value<'jit, 'vm>),
}
@@ -497,7 +497,7 @@ impl<'jit, 'vm> Thunk<'jit, 'vm> {
}
}
pub fn capture(&self, env: LetEnv<'jit, 'vm>) {
pub fn capture(&self, env: Rc<LetEnv<'jit, 'vm>>) {
if let _Thunk::Code(_, envcell) = &*self.thunk.borrow() {
envcell.get_or_init(|| env);
}