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//! - `ffi::jit_kinds` - JIT-specific heap kinds and allocation types
11//! - `ffi::value_ffi` - NaN-boxing value encoding/decoding helpers
12//! - `context` - JITContext, JITDataFrame, and related structures
13//! - `ffi` - FFI functions called from JIT-compiled code
14//! - `loop_analysis` - Loop analysis for JIT optimization
15//! - `osr_compiler` - OSR (On-Stack Replacement) loop compilation
16//! - `ffi_refs` - FFI function references for heap operations
17//! - `compiler` - JITCompiler implementation (split into logical modules)
18//! - `core` - Legacy re-exports and tests
19
20mod compiler;
21pub mod context;
22mod core;
23pub mod error;
24pub mod executor;
25pub mod ffi;
26pub(crate) mod ffi_refs;
27mod ffi_symbols;
28mod foreign_bridge;
29pub mod jit_array;
30pub mod jit_cache;
31pub mod jit_matrix;
32pub mod loop_analysis;
33pub mod mixed_table;
34pub mod mir_compiler;
35mod numeric_compiler;
36mod optimizer;
37pub mod osr_compiler;
38pub mod worker;
39
40// Re-export commonly used items at module level
41pub use context::*;
42pub use error::JitError;
43pub use executor::JITExecutor;
44pub use ffi::jit_kinds::*;
45pub use ffi::value_ffi::*;
46
47pub use shape_ast as ast;
48pub use shape_runtime as runtime;
49
50// Re-export JITCompiler and related items from compiler module
51pub use self::compiler::JITCompiler;
52// JITKernelCompiler re-export removed — runtime-side
53// `shape_runtime::simulation` module bulldozed in 2601ba7. See
54// `compiler/setup.rs` comment block. Re-introduction owned by the
55// simulation-kernel-extension-rebuild workstream.
56pub use self::compiler::JitParityEntry;
57pub use self::compiler::JitParityTarget;
58pub use self::compiler::JitPreflightReport;
59pub use self::compiler::build_full_builtin_parity_matrix;
60pub use self::compiler::build_full_opcode_parity_matrix;
61pub use self::compiler::build_program_parity_matrix;
62pub use self::compiler::can_jit_compile;
63pub use self::compiler::get_incomplete_opcodes;
64pub use self::compiler::get_unsupported_opcodes;
65pub use self::compiler::preflight_blob_jit_compatibility;
66pub use self::compiler::preflight_instructions;
67pub use self::compiler::preflight_jit_compatibility;
68pub use self::osr_compiler::{OsrCompilationResult, compile_osr_loop};
69pub use self::worker::JitCompilationBackend;