Skip to main content

OrcJitState

Struct OrcJitState 

Source
pub(crate) struct OrcJitState {
    pub(crate) global: &'static GlobalOrcJit,
    pub(crate) jd_guard: Arc<JitDylibGuard>,
    pub(crate) staged_functions: HashMap<u32, FunctionValue<'static>, FxBuildHasher>,
    pub(crate) pending_symbols: Vec<(CString, usize)>,
    pub(crate) loaded_trackers: Vec<ResourceTracker>,
    pub(crate) committed_functions: HashMap<u32, usize, FxBuildHasher>,
    pub(crate) last_compiled_object: Option<Vec<u8>>,
    pub(crate) clear_pool_counter: u32,
}
Expand description

ORC JIT state for the LLVM backend (JIT mode only).

The LLVM context is owned separately (via tscx) and persists across JIT resets. Each compiler gets its own JITDylib in the global LLJIT for symbol isolation.

Fields§

§global: &'static GlobalOrcJit

Reference to the global LLJIT instance.

§jd_guard: Arc<JitDylibGuard>

Shared guard that owns the JITDylib. The JD is not recycled until all Arc<JitDylibGuard> holders (including external callers) are dropped.

Declared before loaded_trackers so it drops first: removeJITDylib (called in JitDylibGuard::drop) clears the JITDylib internally and must run while the tracker handles are still live.

§staged_functions: HashMap<u32, FunctionValue<'static>, FxBuildHasher>

Functions in the current staging module (not yet committed to JIT).

§pending_symbols: Vec<(CString, usize)>

Absolute symbols collected during translation, flushed to the global builtins JITDylib before commit.

§loaded_trackers: Vec<ResourceTracker>

Resource trackers for committed JIT modules, used for code removal.

§committed_functions: HashMap<u32, usize, FxBuildHasher>

Maps committed function ID → index into loaded_trackers.

§last_compiled_object: Option<Vec<u8>>

Cached object buffer from the last commit_staged_module, captured via ObjectTransformLayer.

§clear_pool_counter: u32

Counter for throttling SymbolStringPool::clearDeadEntries() calls.

Implementations§

Source§

impl OrcJitState

Source

pub(crate) fn new( debug_support: bool, profiling_support: bool, simple_perf: bool, ) -> Result<Self>

Source

pub(crate) fn clear(&mut self) -> Result<()>

Clears all code and symbols from this compiler’s JITDylib.

Source

pub(crate) fn maybe_clear_dead_pool_entries(&mut self)

Periodically clears dead entries from the global SymbolStringPool.

clearDeadEntries is O(pool_size), so we throttle it to avoid O(N²) total cost over many compilations.

Source

pub(crate) fn jd(&self) -> JITDylibRef

Trait Implementations§

Source§

impl Debug for OrcJitState

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 160 bytes