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 taggingcontext- JITContext, JITDataFrame, and related structuresffi- FFI functions called from JIT-compiled codetranslator- BytecodeToIR bytecode-to-IR translationcompiler- 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§
- Bytecode
ToIR - Bytecode to IR compiler helper
- JITCompiler
- JITKernel
Compiler - Thread-safe wrapper around JITCompiler for use with ExecutionContext.
- JitParity
Entry - Program-level JIT parity entry (opcode/builtin support row).
- JitPreflight
Report - Program-level preflight report for JIT capability checks.
- OsrCompilation
Result - Result of compiling a loop body for OSR entry.
Enums§
- JitParity
Target - 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.