Skip to main content

Crate shape_jit

Crate shape_jit 

Source
Expand description

JIT Compiler Module for Shape

Compiles Shape bytecode to native x86-64/ARM machine code using Cranelift for high-performance strategy execution in backtesting.

§Module Structure

  • ffi::jit_kinds - JIT-specific heap kinds and allocation types
  • ffi::value_ffi - NaN-boxing value encoding/decoding helpers
  • context - JITContext, JITDataFrame, and related structures
  • ffi - FFI functions called from JIT-compiled code
  • loop_analysis - Loop analysis for JIT optimization
  • osr_compiler - OSR (On-Stack Replacement) loop compilation
  • ffi_refs - FFI function references for heap operations
  • compiler - JITCompiler implementation (split into logical modules)
  • core - Legacy re-exports and tests

Re-exports§

pub use error::JitError;
pub use executor::JITExecutor;
pub use self::osr_compiler::OsrCompilationResult;
pub use self::osr_compiler::compile_osr_loop;
pub use self::worker::JitCompilationBackend;
pub use shape_ast as ast;
pub use shape_runtime as runtime;
pub use context::*;
pub use ffi::jit_kinds::*;
pub use ffi::value_ffi::*;

Modules§

context
JIT Context and Related Data Structures
error
JIT compiler error types.
executor
JIT executor implementing the ProgramExecutor trait
ffi
FFI Functions for JIT-compiled Code
jit_array
JIT array — Route A close.
jit_cache
Content-addressed JIT code cache with dependency-based invalidation.
jit_matrix
Native JIT matrix with guaranteed C-compatible layout.
loop_analysis
Loop Analysis for JIT Optimization
mir_compiler
MIR-to-Cranelift IR compiler (JIT v2).
mixed_table
Mixed function table supporting both JIT-compiled and interpreter-fallback entries.
osr_compiler
OSR (On-Stack Replacement) Loop Compilation
worker
JIT Compilation Backend

Structs§

JITCompiler
JitParityEntry
Program-level JIT parity entry (opcode/builtin support row).
JitPreflightReport
Program-level preflight report for JIT capability checks.

Enums§

JitParityTarget
What the parity row describes.

Functions§

build_full_builtin_parity_matrix
Build a full builtin parity matrix across the entire BuiltinFunction surface.
build_full_opcode_parity_matrix
Build a full opcode parity matrix across the entire VM opcode surface.
build_program_parity_matrix
Build a program-specific JIT parity matrix.
can_jit_compile
Check if a bytecode program can be fully JIT-compiled
get_incomplete_opcodes
Get a list of opcodes that have placeholder (incomplete) implementations
get_unsupported_opcodes
Get a list of unsupported opcodes in a program (for debugging)
preflight_blob_jit_compatibility
Run JIT compatibility preflight on a single function blob.
preflight_instructions
Run JIT compatibility preflight on a raw instruction slice.
preflight_jit_compatibility
Run JIT preflight and collect all constructs that require VM fallback.