pub trait IntChunkCompiler {
// Required methods
fn try_compile(
&self,
storage: &mut dyn JitStorage,
proto: Gc<Proto>,
pre53: bool,
float_only: bool,
) -> CompileResult;
fn enter(&self, vm: *mut Vm, cl: Option<Gc<LuaClosure>>) -> JitVmGuard;
}Expand description
Closure-compilation backend. The interpreter dispatcher (and the
Op::Call JIT fast path inside vm/exec.rs) calls
chunk_compiler.try_compile(proto, pre53, float_only) once per
Proto on the cold path; subsequent hits read the result back from
Proto.jit: Cell<JitProtoState> directly, so the vtable cost is
bounded by Proto count, not by call count.
enter is the per-JIT-entry RAII guard that pins the active Vm
pointer (and optional LuaClosure) into the thread-locals the JIT
helpers read. Taking a raw *mut Vm keeps the trait object-safe
and lets the dispatcher pass self as *mut Vm without holding a
mutable borrow on self while reading self.chunk_compiler.
Required Methods§
Sourcefn try_compile(
&self,
storage: &mut dyn JitStorage,
proto: Gc<Proto>,
pre53: bool,
float_only: bool,
) -> CompileResult
fn try_compile( &self, storage: &mut dyn JitStorage, proto: Gc<Proto>, pre53: bool, float_only: bool, ) -> CompileResult
Attempt to compile proto. Returns CompileResult::Compiled on
a whitelist hit or CompileResult::Skipped when the body is
outside the JIT’s supported shape.
v2.0 Track J sub-step J-B — storage is the per-Vm JIT cache
- handle holder. The Cranelift backend downcasts it to its
concrete
CraneliftJitStorage; the no-opNullJitBackendignores it (returnsSkippedwithout touching storage).
Sourcefn enter(&self, vm: *mut Vm, cl: Option<Gc<LuaClosure>>) -> JitVmGuard
fn enter(&self, vm: *mut Vm, cl: Option<Gc<LuaClosure>>) -> JitVmGuard
Install the active Vm + closure pointer into the JIT
helpers’ thread-local slots; the returned guard restores
state on drop. For NullJitBackend this is a no-op
(helpers never fire because nothing compiled).
SAFETY: the caller must ensure vm is a live, exclusively
borrowed Vm for the duration of the returned guard.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".