chore: cargo fmt

This commit is contained in:
2025-05-19 11:33:18 +08:00
parent e17c48f2d9
commit 6d26716412
14 changed files with 209 additions and 79 deletions

View File

@@ -1,8 +1,8 @@
use std::cell::{Cell, OnceCell};
use derive_more::Constructor;
use inkwell::execution_engine::JitFunction;
use itertools::Itertools;
use derive_more::Constructor;
use crate::bytecode::Func as BFunc;
use crate::error::Result;
@@ -46,7 +46,7 @@ pub struct Func<'jit: 'vm, 'vm> {
pub func: &'vm BFunc,
pub env: Env<'jit, 'vm>,
pub compiled: OnceCell<JitFunction<'jit, JITFunc<'jit, 'vm>>>,
pub count: Cell<usize>
pub count: Cell<usize>,
}
impl<'vm, 'jit: 'vm> Func<'jit, 'vm> {
@@ -94,7 +94,7 @@ impl<'vm, 'jit: 'vm> Func<'jit, 'vm> {
if count >= 1 {
let compiled = self.compiled.get_or_init(|| vm.compile_func(self.func));
let ret = unsafe { compiled.call(vm as *const VM, &env as *const Env) };
return Ok(ret.into())
return Ok(ret.into());
}
vm.eval(self.func.opcodes.iter().copied(), env)
}