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 mixed_table;
28pub mod nan_boxing;
29mod numeric_compiler;
30mod optimizer;
31mod translator;
32pub mod worker;
33
34// Re-export commonly used items at module level
35pub use context::*;
36pub use error::JitError;
37pub use executor::JITExecutor;
38pub use nan_boxing::*;
39
40pub use shape_ast as ast;
41pub use shape_runtime as runtime;
42
43// Re-export JITCompiler and related items from compiler module
44pub use self::compiler::JITCompiler;
45pub use self::compiler::JITKernelCompiler;
46pub use self::compiler::JitParityEntry;
47pub use self::compiler::JitParityTarget;
48pub use self::compiler::JitPreflightReport;
49pub use self::compiler::build_full_builtin_parity_matrix;
50pub use self::compiler::build_full_opcode_parity_matrix;
51pub use self::compiler::build_program_parity_matrix;
52pub use self::compiler::can_jit_compile;
53pub use self::compiler::get_incomplete_opcodes;
54pub use self::compiler::get_unsupported_opcodes;
55pub use self::compiler::preflight_blob_jit_compatibility;
56pub use self::compiler::preflight_instructions;
57pub use self::compiler::preflight_jit_compatibility;
58pub use self::translator::BytecodeToIR;
59pub use self::translator::{OsrCompilationResult, compile_osr_loop};
60pub use self::worker::JitCompilationBackend;