feat: JIT (WIP)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
use derive_more::Constructor;
|
||||
use std::cell::{Cell, OnceCell};
|
||||
|
||||
use itertools::Itertools;
|
||||
use derive_more::Constructor;
|
||||
|
||||
use crate::bytecode::Func as BFunc;
|
||||
use crate::error::Result;
|
||||
use crate::ir;
|
||||
use crate::jit::JITFunc;
|
||||
use crate::ty::internal::{Thunk, Value};
|
||||
use crate::vm::{Env, VM};
|
||||
|
||||
@@ -37,14 +40,12 @@ impl From<ir::Param> for Param {
|
||||
}
|
||||
}
|
||||
|
||||
pub type JITFunc<'vm> =
|
||||
unsafe extern "C" fn(vm: *mut VM<'_>, *mut Env<'vm>, *mut Value<'vm>) -> Value<'vm>;
|
||||
|
||||
#[derive(Debug, Clone, Constructor)]
|
||||
pub struct Func<'vm> {
|
||||
pub func: &'vm BFunc,
|
||||
pub env: Env<'vm>,
|
||||
pub compiled: Option<JITFunc<'vm>>,
|
||||
pub compiled: OnceCell<JITFunc>,
|
||||
pub count: Cell<usize>
|
||||
}
|
||||
|
||||
impl<'vm> Func<'vm> {
|
||||
|
||||
Reference in New Issue
Block a user