feat: a lot

This commit is contained in:
2025-08-06 18:30:19 +08:00
parent 32c602f21c
commit f946cb2fd1
22 changed files with 735 additions and 591 deletions

View File

@@ -19,13 +19,13 @@ pub use compile::JITCompile;
use helpers::*;
pub trait JITContext: EvalContext + Sized {
fn lookup_stack(&self, offset: usize) -> &Value<Self>;
fn lookup_arg(&self, offset: usize) -> &Value<Self>;
fn enter_with(&mut self, namespace: Rc<HashMap<String, Value<Self>>>);
fn lookup_stack(&self, offset: usize) -> &Value;
fn lookup_arg(&self, offset: usize) -> &Value;
fn enter_with(&mut self, namespace: Rc<HashMap<String, Value>>);
fn exit_with(&mut self);
}
type F<Ctx: JITContext> = unsafe extern "C" fn(*const Ctx, *mut Value<Ctx>);
type F<Ctx> = unsafe extern "C" fn(*const Ctx, *mut Value);
pub struct JITFunc<Ctx: JITContext> {
func: F<Ctx>,