Struct cranelift_jit::JITModule [−][src]
A JITModule
implements Module
and emits code and data into memory where it can be
directly called and accessed.
See the JITBuilder
for a convenient way to construct JITModule
instances.
Implementations
impl JITModule
[src]
pub unsafe fn free_memory(&mut self)
[src]
Free memory allocated for code and data segments of compiled functions.
Safety
Because this function invalidates any pointers retrived from the
corresponding module, it should only be used when none of the functions
from that module are currently executing and none of the fn
pointers
are called afterwards.
pub fn get_finalized_function(&self, func_id: FuncId) -> *const u8
[src]
Returns the address of a finalized function.
pub fn get_finalized_data(&self, data_id: DataId) -> (*const u8, usize)
[src]
Returns the address and size of a finalized data object.
pub fn finalize_definitions(&mut self)
[src]
Finalize all functions and data objects that are defined but not yet finalized. All symbols referenced in their bodies that are declared as needing a definition must be defined by this point.
Use get_finalized_function
and get_finalized_data
to obtain the final
artifacts.
pub fn new(builder: JITBuilder) -> Self
[src]
Create a new JITModule
.
pub fn prepare_for_function_redefine(
&mut self,
func_id: FuncId
) -> ModuleResult<()>
[src]
&mut self,
func_id: FuncId
) -> ModuleResult<()>
Allow a single future define_function
on a previously defined function. This allows for
hot code swapping and lazy compilation of functions.
This requires hotswap support to be enabled first using JITBuilder::hotswap
.
Trait Implementations
impl Module for JITModule
[src]
fn isa(&self) -> &dyn TargetIsa
[src]
fn declarations(&self) -> &ModuleDeclarations
[src]
fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>
[src]
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature
) -> ModuleResult<FuncId>
fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
[src]
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool
) -> ModuleResult<DataId>
fn declare_func_in_func(&self, func: FuncId, in_func: &mut Function) -> FuncRef
[src]
Use this when you’re building the IR of a function to reference a function.
TODO: Coalesce redundant decls and signatures. TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.
fn declare_data_in_func(&self, data: DataId, func: &mut Function) -> GlobalValue
[src]
Use this when you’re building the IR of a function to reference a data object.
TODO: Same as above.
fn declare_func_in_data(&self, func: FuncId, ctx: &mut DataContext) -> FuncRef
[src]
TODO: Same as above.
fn declare_data_in_data(
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValue
[src]
&self,
data: DataId,
ctx: &mut DataContext
) -> GlobalValue
TODO: Same as above.
fn define_function(
&mut self,
id: FuncId,
ctx: &mut Context,
trap_sink: &mut dyn TrapSink
) -> ModuleResult<ModuleCompiledFunction>
[src]
&mut self,
id: FuncId,
ctx: &mut Context,
trap_sink: &mut dyn TrapSink
) -> ModuleResult<ModuleCompiledFunction>
fn define_function_bytes(
&mut self,
id: FuncId,
bytes: &[u8],
relocs: &[RelocRecord]
) -> ModuleResult<ModuleCompiledFunction>
[src]
&mut self,
id: FuncId,
bytes: &[u8],
relocs: &[RelocRecord]
) -> ModuleResult<ModuleCompiledFunction>
fn define_data(&mut self, id: DataId, data: &DataContext) -> ModuleResult<()>
[src]
pub fn get_name(&self, name: &str) -> Option<FuncOrDataId>
[src]
pub fn target_config(&self) -> TargetFrontendConfig
[src]
pub fn make_context(&self) -> Context
[src]
pub fn clear_context(&self, ctx: &mut Context)
[src]
pub fn make_signature(&self) -> Signature
[src]
pub fn clear_signature(&self, sig: &mut Signature)
[src]
Auto Trait Implementations
impl !RefUnwindSafe for JITModule
impl !Send for JITModule
impl !Sync for JITModule
impl Unpin for JITModule
impl !UnwindSafe for JITModule
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,