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: LLVMOrcLLJITRefImplementations§
Source§impl LLJIT
impl LLJIT
Sourcepub fn builder() -> LLJITBuilder
pub fn builder() -> LLJITBuilder
Creates a new LLJIT builder.
Sourcepub fn new() -> Result<Self, LLVMString>
pub fn new() -> Result<Self, LLVMString>
Creates a new ORC JIT, auto-detecting the host target.
Sourcepub unsafe fn from_inner(jit: LLVMOrcLLJITRef) -> Self
pub unsafe fn from_inner(jit: LLVMOrcLLJITRef) -> Self
Wraps a raw pointer.
Sourcepub fn get_triple_string(&self) -> &CStr
pub fn get_triple_string(&self) -> &CStr
Return the target triple for this LLJIT instance.
Sourcepub fn get_data_layout_string(&self) -> &CStr
pub fn get_data_layout_string(&self) -> &CStr
Return the data layout for this LLJIT instance.
Sourcepub fn get_global_prefix(&self) -> c_char
pub fn get_global_prefix(&self) -> c_char
Returns the global prefix character according to the LLJIT’s DataLayout.
Sourcepub fn add_module(&self, tsm: ThreadSafeModule) -> Result<(), LLVMString>
pub fn add_module(&self, tsm: ThreadSafeModule) -> Result<(), LLVMString>
Add an IR module to the main JITDylib.
Sourcepub fn add_module_with_dylib(
&self,
tsm: ThreadSafeModule,
jd: JITDylibRef,
) -> Result<(), LLVMString>
pub fn add_module_with_dylib( &self, tsm: ThreadSafeModule, jd: JITDylibRef, ) -> Result<(), LLVMString>
Add an IR module to the given JITDylib.
Sourcepub fn add_module_with_rt(
&self,
tsm: ThreadSafeModule,
rt: &ResourceTracker,
) -> Result<(), LLVMString>
pub fn add_module_with_rt( &self, tsm: ThreadSafeModule, rt: &ResourceTracker, ) -> Result<(), LLVMString>
Add an IR module to the given ResourceTracker’s JITDylib.
Sourcepub fn get_execution_session(&self) -> ExecutionSessionRef<'_>
pub fn get_execution_session(&self) -> ExecutionSessionRef<'_>
Gets the execution session.
Sourcepub fn get_main_jit_dylib(&self) -> JITDylibRef
pub fn get_main_jit_dylib(&self) -> JITDylibRef
Return a reference to the Main JITDylib.
Sourcepub fn mangle_and_intern(&self, unmangled_name: &CStr) -> SymbolStringPoolEntry
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.
Sourcepub fn lookup(&self, name: &CStr) -> Result<usize, LLVMString>
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 unmangled — LLVMOrcLLJITLookup applies the data layout
prefix (e.g. _ on macOS) internally.
Sourcepub fn lookup_in(
&self,
jd: JITDylibRef,
name: &CStr,
) -> Result<usize, LLVMString>
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.
Sourcepub fn get_ir_transform_layer(&self) -> IRTransformLayerRef
pub fn get_ir_transform_layer(&self) -> IRTransformLayerRef
Returns a non-owning reference to the LLJIT instance’s IR transform layer.
Sourcepub fn get_obj_transform_layer(&self) -> ObjectTransformLayerRef
pub fn get_obj_transform_layer(&self) -> ObjectTransformLayerRef
Returns a non-owning reference to the LLJIT instance’s object transform layer.
Sourcepub fn enable_perf_support(&self) -> Result<(), LLVMString>
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.
Sourcepub fn enable_simple_perf(&self) -> Result<(), LLVMString>
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.
Sourcepub fn enable_debug_support(&self) -> Result<(), LLVMString>
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§
Auto Trait Implementations§
impl Freeze for LLJIT
impl RefUnwindSafe for LLJIT
impl Unpin for LLJIT
impl UnsafeUnpin for LLJIT
impl UnwindSafe for LLJIT
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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