Skip to main content

JITContext

Struct JITContext 

Source
#[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 f64

Array of column pointers (SIMD-aligned f64 arrays) Column order matches DataFrameSchema.column_names

§column_count: usize

Number of columns in the DataFrame

§row_count: usize

Number of rows in the DataFrame

§current_row: usize

Current 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_void

Pointer to event queue (for FFI calls to poll/push events) Points to a SharedEventQueue behind the scenes

§suspension_state: u32

Suspension state: 0 = running, 1 = yielded, 2 = suspended

§iterations_since_yield: u64

Iterations since last yield (for cooperative scheduling)

§yield_threshold: u64

Yield threshold - yield after this many iterations 0 = never yield automatically

§alert_pipeline_ptr: *mut c_void

Alert pipeline pointer (for FFI calls to emit alerts) Points to AlertRouter behind the scenes

§simulation_mode: u32

Simulation mode: 0 = disabled, 1 = DenseKernel, 2 = HybridKernel

§simulation_state_ptr: *mut u8

Pointer to simulation state (TypedObject for DenseKernel) JIT code accesses state fields via direct memory offset

§simulation_state_size: usize

Size of simulation state data (for deallocation)

§gc_safepoint_flag_ptr: *const u8

Pointer 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_void

Pointer to GcHeap for allocation fast path. Null when GC is not enabled.

§foreign_bridge_ptr: *const c_void

Opaque pointer to JIT foreign-call bridge state. Null when no foreign functions are linked for this execution.

Implementations§

Source§

impl JITContext

Source

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

Source

pub fn set_current_row(&mut self, index: usize)

Update current row index for DataFrame iteration

Source

pub fn update_current_row(&mut self, index: usize)

Update current row for backtest iteration (alias for backward compatibility)

Source

pub fn is_simulation_mode(&self) -> bool

Check if in simulation mode

Source

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 state
  • state_size - Size of state data
  • column_ptrs - Pointers to data columns
  • column_count - Number of columns
  • row_count - Number of rows
  • timestamps - Pointer to timestamp array
Source

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.

Source

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.

Source

pub fn clear_simulation(&mut self)

Clear simulation mode.

Trait Implementations§

Source§

impl Clone for JITContext

Source§

fn clone(&self) -> JITContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JITContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JITContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more