zkvmc_context/
compiler.rs1use crate::Context;
2use std::ptr::NonNull;
3
4#[repr(transparent)]
6#[derive(Clone, Copy)]
7pub struct JitFn(pub extern "C" fn(NonNull<Context>) -> JitFn);
8
9pub extern "C" fn trampoline(ctx: NonNull<Context>) -> JitFn {
12 unsafe { (*ctx.as_ptr()).compiler.compile(ctx) }
13}
14
15pub trait Compiler {
17 fn compile(&mut self, ctx: NonNull<Context>) -> JitFn;
19}
20
21pub struct NoopCompiler;
22impl Compiler for NoopCompiler {
23 fn compile(&mut self, _ctx: NonNull<Context>) -> JitFn {
24 unreachable!()
25 }
26}
27
28#[derive(Default)]
29pub struct CompileConfig {
30 pub dump: bool,
32}