Skip to main content

shape_jit/
lib.rs

1#![allow(clippy::result_large_err)]
2
3//! JIT Compiler Module for Shape
4//!
5//! Compiles Shape bytecode to native x86-64/ARM machine code using Cranelift
6//! for high-performance strategy execution in backtesting.
7//!
8//! # Module Structure
9//!
10//! - `nan_boxing` - NaN-boxing constants and helper functions for type tagging
11//! - `context` - JITContext, JITDataFrame, and related structures
12//! - `ffi` - FFI functions called from JIT-compiled code
13//! - `translator` - BytecodeToIR bytecode-to-IR translation
14//! - `compiler` - JITCompiler implementation (split into logical modules)
15//! - `core` - Legacy re-exports and tests
16
17mod compiler;
18pub mod context;
19mod core;
20pub mod error;
21pub mod executor;
22pub mod ffi;
23mod ffi_symbols;
24mod foreign_bridge;
25pub mod jit_array;
26pub mod jit_cache;
27pub mod jit_matrix;
28pub mod mixed_table;
29pub mod nan_boxing;
30mod numeric_compiler;
31mod optimizer;
32mod translator;
33pub mod worker;
34
35// Re-export commonly used items at module level
36pub use context::*;
37pub use error::JitError;
38pub use executor::JITExecutor;
39pub use nan_boxing::*;
40
41pub use shape_ast as ast;
42pub use shape_runtime as runtime;
43
44// Re-export JITCompiler and related items from compiler module
45pub use self::compiler::JITCompiler;
46pub use self::compiler::JITKernelCompiler;
47pub use self::compiler::JitParityEntry;
48pub use self::compiler::JitParityTarget;
49pub use self::compiler::JitPreflightReport;
50pub use self::compiler::build_full_builtin_parity_matrix;
51pub use self::compiler::build_full_opcode_parity_matrix;
52pub use self::compiler::build_program_parity_matrix;
53pub use self::compiler::can_jit_compile;
54pub use self::compiler::get_incomplete_opcodes;
55pub use self::compiler::get_unsupported_opcodes;
56pub use self::compiler::preflight_blob_jit_compatibility;
57pub use self::compiler::preflight_instructions;
58pub use self::compiler::preflight_jit_compatibility;
59pub use self::translator::BytecodeToIR;
60pub use self::translator::{OsrCompilationResult, compile_osr_loop};
61pub use self::worker::JitCompilationBackend;