use crate::Context;
use std::ptr::NonNull;
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct JitFn(pub extern "C" fn(NonNull<Context>) -> JitFn);
pub extern "C" fn trampoline(ctx: NonNull<Context>) -> JitFn {
unsafe { (*ctx.as_ptr()).compiler.compile(ctx) }
}
pub trait Compiler {
fn compile(&mut self, ctx: NonNull<Context>) -> JitFn;
}
pub struct NoopCompiler;
impl Compiler for NoopCompiler {
fn compile(&mut self, _ctx: NonNull<Context>) -> JitFn {
unreachable!()
}
}
#[derive(Default)]
pub struct CompileConfig {
pub dump: bool,
}