Skip to main content

LLJIT

Struct LLJIT 

Source
pub struct LLJIT {
    jit: LLVMOrcLLJITRef,
}
Expand description

An ORC JIT.

Manages the memory of all JIT’d code and all modules that are transferred to it.

See the ORCv2 docs.

Fields§

§jit: LLVMOrcLLJITRef

Implementations§

Source§

impl LLJIT

Source

pub fn builder() -> LLJITBuilder

Creates a new LLJIT builder.

Source

pub fn new() -> Result<Self, LLVMString>

Creates a new ORC JIT, auto-detecting the host target.

Source

pub unsafe fn from_inner(jit: LLVMOrcLLJITRef) -> Self

Wraps a raw pointer.

Source

pub fn as_inner(&self) -> LLVMOrcLLJITRef

Unwraps the raw pointer.

Source

pub fn get_triple_string(&self) -> &CStr

Return the target triple for this LLJIT instance.

Source

pub fn get_data_layout_string(&self) -> &CStr

Return the data layout for this LLJIT instance.

Source

pub fn get_global_prefix(&self) -> c_char

Returns the global prefix character according to the LLJIT’s DataLayout.

Source

pub fn add_module(&self, tsm: ThreadSafeModule) -> Result<(), LLVMString>

Add an IR module to the main JITDylib.

Source

pub fn add_module_with_dylib( &self, tsm: ThreadSafeModule, jd: JITDylibRef, ) -> Result<(), LLVMString>

Add an IR module to the given JITDylib.

Source

pub fn add_module_with_rt( &self, tsm: ThreadSafeModule, rt: &ResourceTracker, ) -> Result<(), LLVMString>

Add an IR module to the given ResourceTracker’s JITDylib.

Source

pub fn get_execution_session(&self) -> ExecutionSessionRef<'_>

Gets the execution session.

Source

pub fn get_main_jit_dylib(&self) -> JITDylibRef

Return a reference to the Main JITDylib.

Source

pub fn mangle_and_intern(&self, unmangled_name: &CStr) -> SymbolStringPoolEntry

Mangles the given string according to the LLJIT instance’s DataLayout, then interns the result in the SymbolStringPool and returns a reference to the pool entry.

Source

pub fn lookup(&self, name: &CStr) -> Result<usize, LLVMString>

Look up the given symbol in the main JITDylib of the given LLJIT instance.

The name is unmangledLLVMOrcLLJITLookup applies the data layout prefix (e.g. _ on macOS) internally.

Source

pub fn lookup_in( &self, jd: JITDylibRef, name: &CStr, ) -> Result<usize, LLVMString>

Look up a symbol in a specific JITDylib.

Unlike lookup, which only searches the main JITDylib, this searches the given jd. The name is unmangled — the LLJIT applies the data layout prefix (e.g. _ on macOS) internally.

Source

pub fn get_ir_transform_layer(&self) -> IRTransformLayerRef

Returns a non-owning reference to the LLJIT instance’s IR transform layer.

Source

pub fn get_obj_transform_layer(&self) -> ObjectTransformLayerRef

Returns a non-owning reference to the LLJIT instance’s object transform layer.

Source

pub fn enable_perf_support(&self) -> Result<(), LLVMString>

Install PerfSupportPlugin on the LLJIT’s ObjectLinkingLayer.

Writes perf jitdump records so perf record -k 1 / perf inject --jit can resolve JIT-compiled symbols with full debug info and unwind info. Requires ObjectLinkingLayer (JITLink), which is the LLJIT default.

Source

pub fn enable_simple_perf(&self) -> Result<(), LLVMString>

Install SimplePerfSupportPlugin on the LLJIT’s ObjectLinkingLayer.

Writes /tmp/perf-<pid>.map in the perf map format so that profilers like perf and samply can resolve JIT-compiled symbols without the heavyweight jitdump machinery. Requires ObjectLinkingLayer (JITLink), which is the LLJIT default.

Not suitable for long-running programs. The map file is append-only and never cleaned up, so entries for freed JIT code accumulate indefinitely. Prefer enable_perf_support (jitdump) for long-lived processes.

Source

pub fn enable_debug_support(&self) -> Result<(), LLVMString>

Install the plugin that submits debug objects to the executor via the GDB JIT Interface (__jit_debug_register_code).

On ELF this installs ELFDebugObjectPlugin; on MachO, GDBJITDebugInfoRegistrationPlugin. Requires ObjectLinkingLayer (JITLink), which is the LLJIT default.

Once enabled, compiled objects containing DWARF debug info are automatically registered so that GDB, LLDB, perf, and other profilers can resolve JIT-compiled function names and source locations.

Trait Implementations§

Source§

impl Debug for LLJIT

Source§

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

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

impl Drop for LLJIT

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for LLJIT

Source§

impl Sync for LLJIT

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: 8 bytes