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

  • nan_boxing - NaN-boxing constants and helper functions for type tagging
  • context - JITContext, JITDataFrame, and related structures
  • ffi - FFI functions called from JIT-compiled code
  • translator - BytecodeToIR bytecode-to-IR translation
  • 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::worker::JitCompilationBackend;
pub use shape_ast as ast;
pub use shape_runtime as runtime;
pub use context::*;
pub use nan_boxing::*;

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
Native JIT array with guaranteed C-compatible layout.
jit_cache
Content-addressed JIT code cache with dependency-based invalidation.
mixed_table
Mixed function table supporting both JIT-compiled and interpreter-fallback entries.
nan_boxing
JIT NaN-boxing layer — unified tag scheme.
worker
JIT Compilation Backend

Structs§

BytecodeToIR
Bytecode to IR compiler helper
JITCompiler
JITKernelCompiler
Thread-safe wrapper around JITCompiler for use with ExecutionContext.
JitParityEntry
Program-level JIT parity entry (opcode/builtin support row).
JitPreflightReport
Program-level preflight report for JIT capability checks.
OsrCompilationResult
Result of compiling a loop body for OSR entry.

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
compile_osr_loop
Compile a loop body for OSR (On-Stack Replacement) entry.
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.