Struct cranelift_simplejit::SimpleJITBuilder
source · pub struct SimpleJITBuilder { /* private fields */ }
Expand description
A builder for SimpleJITBackend
.
Implementations
sourceimpl SimpleJITBuilder
impl SimpleJITBuilder
sourcepub fn with_isa(isa: Box<dyn TargetIsa>) -> Self
pub fn with_isa(isa: Box<dyn TargetIsa>) -> Self
Create a new SimpleJITBuilder
with an arbitrary target. This is mainly
useful for testing.
SimpleJIT requires a TargetIsa
configured for non-PIC.
To create a SimpleJITBuilder
for native use, use the new
constructor
instead.
sourcepub fn symbol<K>(&mut self, name: K, ptr: *const u8) -> &Selfwhere
K: Into<String>,
pub fn symbol<K>(&mut self, name: K, ptr: *const u8) -> &Selfwhere
K: Into<String>,
Define a symbol in the internal symbol table.
The JIT will use the symbol table to resolve names that are declared, but not defined, in the module being compiled. A common example is external functions. With this method, functions and data can be exposed to the code being compiled which are defined by the host.
If a symbol is defined more than once, the most recent definition will be retained.
If the JIT fails to find a symbol in its internal table, it will fall back to a platform-specific search (this typically involves searching the current process for public symbols, followed by searching the platform’s C runtime).