#[repr(C)]pub struct JITContext {Show 29 fields
pub in_position: bool,
pub position_side: i8,
pub entry_price: u64,
pub unrealized_pnl_pct: u64,
pub timestamps_ptr: *const i64,
pub column_ptrs: *const *const f64,
pub column_count: usize,
pub row_count: usize,
pub current_row: usize,
pub locals: [u64; 256],
pub stack: [u64; 512],
pub stack_ptr: usize,
pub heap_ptr: *mut c_void,
pub function_table: *const JittedStrategyFn,
pub function_table_len: usize,
pub exec_context_ptr: *mut c_void,
pub function_names_ptr: *const String,
pub function_names_len: usize,
pub event_queue_ptr: *mut c_void,
pub suspension_state: u32,
pub iterations_since_yield: u64,
pub yield_threshold: u64,
pub alert_pipeline_ptr: *mut c_void,
pub simulation_mode: u32,
pub simulation_state_ptr: *mut u8,
pub simulation_state_size: usize,
pub gc_safepoint_flag_ptr: *const u8,
pub gc_heap_ptr: *mut c_void,
pub foreign_bridge_ptr: *const c_void,
}Expand description
JIT execution context passed to compiled functions This struct must be C-compatible (#[repr(C)]) for FFI
Uses NaN-boxing for full type support
Fields§
§in_position: bool§position_side: i8§entry_price: u64§unrealized_pnl_pct: u64§timestamps_ptr: *const i64§column_ptrs: *const *const f64Array of column pointers (SIMD-aligned f64 arrays) Column order matches DataFrameSchema.column_names
column_count: usizeNumber of columns in the DataFrame
row_count: usizeNumber of rows in the DataFrame
current_row: usizeCurrent row index (for backtest iteration)
locals: [u64; 256]§stack: [u64; 512]§stack_ptr: usize§heap_ptr: *mut c_void§function_table: *const JittedStrategyFn§function_table_len: usize§exec_context_ptr: *mut c_void§function_names_ptr: *const String§function_names_len: usize§event_queue_ptr: *mut c_voidPointer to event queue (for FFI calls to poll/push events) Points to a SharedEventQueue behind the scenes
suspension_state: u32Suspension state: 0 = running, 1 = yielded, 2 = suspended
iterations_since_yield: u64Iterations since last yield (for cooperative scheduling)
yield_threshold: u64Yield threshold - yield after this many iterations 0 = never yield automatically
alert_pipeline_ptr: *mut c_voidAlert pipeline pointer (for FFI calls to emit alerts) Points to AlertRouter behind the scenes
simulation_mode: u32Simulation mode: 0 = disabled, 1 = DenseKernel, 2 = HybridKernel
simulation_state_ptr: *mut u8Pointer to simulation state (TypedObject for DenseKernel) JIT code accesses state fields via direct memory offset
simulation_state_size: usizeSize of simulation state data (for deallocation)
gc_safepoint_flag_ptr: *const u8Pointer to GC safepoint flag (AtomicBool raw pointer). Null when GC is not enabled. The JIT safepoint function reads this to determine if a GC cycle is requested.
gc_heap_ptr: *mut c_voidPointer to GcHeap for allocation fast path. Null when GC is not enabled.
foreign_bridge_ptr: *const c_voidOpaque pointer to JIT foreign-call bridge state. Null when no foreign functions are linked for this execution.
Implementations§
Source§impl JITContext
impl JITContext
Sourcepub fn get_column_value(&self, column_index: usize, offset: i32) -> f64
pub fn get_column_value(&self, column_index: usize, offset: i32) -> f64
Get column value at offset from current row column_index is the column index in the DataFrame schema
Sourcepub fn set_current_row(&mut self, index: usize)
pub fn set_current_row(&mut self, index: usize)
Update current row index for DataFrame iteration
Sourcepub fn update_current_row(&mut self, index: usize)
pub fn update_current_row(&mut self, index: usize)
Update current row for backtest iteration (alias for backward compatibility)
Sourcepub fn is_simulation_mode(&self) -> bool
pub fn is_simulation_mode(&self) -> bool
Check if in simulation mode
Sourcepub fn setup_simulation(
&mut self,
state_ptr: *mut u8,
state_size: usize,
column_ptrs: *const *const f64,
column_count: usize,
row_count: usize,
timestamps: *const i64,
)
pub fn setup_simulation( &mut self, state_ptr: *mut u8, state_size: usize, column_ptrs: *const *const f64, column_count: usize, row_count: usize, timestamps: *const i64, )
Set up context for DenseKernel simulation.
§Arguments
state_ptr- Pointer to TypedObject statestate_size- Size of state datacolumn_ptrs- Pointers to data columnscolumn_count- Number of columnsrow_count- Number of rowstimestamps- Pointer to timestamp array
Sourcepub unsafe fn get_state_field_f64(&self, offset: usize) -> f64
pub unsafe fn get_state_field_f64(&self, offset: usize) -> f64
Get simulation state field as f64.
§Safety
Caller must ensure offset is valid for the state TypedObject.
Sourcepub unsafe fn set_state_field_f64(&mut self, offset: usize, value: f64)
pub unsafe fn set_state_field_f64(&mut self, offset: usize, value: f64)
Set simulation state field as f64.
§Safety
Caller must ensure offset is valid for the state TypedObject.
Sourcepub fn clear_simulation(&mut self)
pub fn clear_simulation(&mut self)
Clear simulation mode.
Trait Implementations§
Source§impl Clone for JITContext
impl Clone for JITContext
Source§fn clone(&self) -> JITContext
fn clone(&self) -> JITContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JITContext
impl Debug for JITContext
Auto Trait Implementations§
impl Freeze for JITContext
impl RefUnwindSafe for JITContext
impl !Send for JITContext
impl !Sync for JITContext
impl Unpin for JITContext
impl UnsafeUnpin for JITContext
impl UnwindSafe for JITContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more