Skip to main content

Module jit

Module jit 

Source
Available on crate feature jit only.
Expand description

Trace JIT for Byteflow — Cranelift backend, isolated unsafe.

Compiles int traces (LoadImm, AddImm, SubImm, MulImm, LtImm, EqImm, LeImm, LoadConst, Move, Nop, arithmetic, Div, Mod, bitwise ops including Shl/Shr, Neg, Branch, Jump, Call, Return). A float trace covers LoadConst of Float, Move, Add, Sub, Mul, Div, Eq, Lt, Le, Neg, and the same control opcodes. Scheduler effects, lists, maps, and records stop recording.

Structs§

CompiledTrace
HotCounter
JitCallRecord
Saved caller state for one Opcode::Call.
JitContext
JitFrame
Mutable state for one JIT invocation on the current bytecode frame.
JitReturn
Wire format returned across the native boundary.
JitRuntime
Runtime-wide JIT state: compiled traces are shared; each worker thread owns its own Cranelift module for compilation (the private module_local helper).
TraceCache
TraceCompiler
TraceKey
TraceSpan

Enums§

CompileError
ExitReason
Why a compiled trace stopped.
SyncSlotsResult
Result of copying VM registers into JIT shadow slots.

Constants§

HOT_THRESHOLD
How many times (function, pc) must run before compilation is attempted.
JIT_BUDGET
JIT_CONTINUE
JIT_DEOPT
JIT_EFFECT
JIT_RETURN
JIT_TRAP
MAX_JIT_CALL_DEPTH
Maximum nested intra-chunk calls handled inside one compiled trace.
MAX_TRACE_LENGTH
Maximum instructions recorded into a single trace.

Functions§

apply_exit_to_vm
Apply a native trace exit to a live Vm, producing an optional early VmResult when the trace finished the flow.
force_compile
Force-compile a trace (tests / benchmarks).
hot_threshold
Threshold at which a (function, pc) pair becomes a compilation candidate.
run_compiled_trace
Run a compiled trace against the shadow slot table.
run_compiled_trace_ref
Run a cached trace by reference.
run_vm_with_jit
Run at most budget instructions, retrying compiled traces after each interpreter step when a site becomes hot.
run_vm_with_jit_runtime
Runtime path: shared cache, per-thread compilation module.
sync_slots_from_vm
Copy int-compatible registers from the VM into JIT shadow slots.
sync_slots_to_vm
Write JIT shadow slots back into the active VM register file.
try_run_hot
Compile key if needed and execute once. Returns None when compilation fails (caller should fall back to the interpreter).
try_run_hot_runtime
Shared-runtime variant (no global lock during execution).

Type Aliases§

JitEntry