pub struct SimpleJITModule { /* private fields */ }Expand description
A SimpleJITModule implements Module and emits code and data into memory where it can be
directly called and accessed.
See the SimpleJITBuilder for a convenient way to construct SimpleJITModule instances.
Implementations§
Source§impl SimpleJITModule
impl SimpleJITModule
Sourcepub fn get_finalized_function(&self, func_id: FuncId) -> *const u8
pub fn get_finalized_function(&self, func_id: FuncId) -> *const u8
Returns the address of a finalized function.
Sourcepub fn get_finalized_data(&self, data_id: DataId) -> (*const u8, usize)
pub fn get_finalized_data(&self, data_id: DataId) -> (*const u8, usize)
Returns the address and size of a finalized data object.
Sourcepub fn finalize_definitions(&mut self)
pub fn finalize_definitions(&mut self)
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.
Sourcepub fn new(builder: SimpleJITBuilder) -> Self
pub fn new(builder: SimpleJITBuilder) -> Self
Create a new SimpleJITModule.
Source§impl SimpleJITModule
impl SimpleJITModule
Sourcepub fn finish(self) -> SimpleJITProduct
pub fn finish(self) -> SimpleJITProduct
SimpleJIT emits code and data into memory as it processes them. This method performs no additional processing, but returns a handle which allows freeing the allocated memory. Otherwise said memory is leaked to enable safe handling of the resulting pointers.
This method does not need to be called when access to the memory handle is not required.
Trait Implementations§
Source§impl<'simple_jit_backend> Module for SimpleJITModule
impl<'simple_jit_backend> Module for SimpleJITModule
Source§fn declarations(&self) -> &ModuleDeclarations
fn declarations(&self) -> &ModuleDeclarations
Source§fn declare_function(
&mut self,
name: &str,
linkage: Linkage,
signature: &Signature,
) -> ModuleResult<FuncId>
fn declare_function( &mut self, name: &str, linkage: Linkage, signature: &Signature, ) -> ModuleResult<FuncId>
Source§fn declare_data(
&mut self,
name: &str,
linkage: Linkage,
writable: bool,
tls: bool,
) -> ModuleResult<DataId>
fn declare_data( &mut self, name: &str, linkage: Linkage, writable: bool, tls: bool, ) -> ModuleResult<DataId>
Source§fn define_function<TS>(
&mut self,
id: FuncId,
ctx: &mut Context,
trap_sink: &mut TS,
) -> ModuleResult<ModuleCompiledFunction>where
TS: TrapSink,
fn define_function<TS>(
&mut self,
id: FuncId,
ctx: &mut Context,
trap_sink: &mut TS,
) -> ModuleResult<ModuleCompiledFunction>where
TS: TrapSink,
Context. Read moreSource§fn define_function_bytes(
&mut self,
id: FuncId,
bytes: &[u8],
) -> ModuleResult<ModuleCompiledFunction>
fn define_function_bytes( &mut self, id: FuncId, bytes: &[u8], ) -> ModuleResult<ModuleCompiledFunction>
bytes. Read moreSource§fn define_data(&mut self, id: DataId, data: &DataContext) -> ModuleResult<()>
fn define_data(&mut self, id: DataId, data: &DataContext) -> ModuleResult<()>
DataContext.Source§fn get_name(&self, name: &str) -> Option<FuncOrDataId>
fn get_name(&self, name: &str) -> Option<FuncOrDataId>
Source§fn target_config(&self) -> TargetFrontendConfig
fn target_config(&self) -> TargetFrontendConfig
Source§fn make_context(&self) -> Context
fn make_context(&self) -> Context
Source§fn clear_context(&self, ctx: &mut Context)
fn clear_context(&self, ctx: &mut Context)
Context and reset it for use with a new function. Read moreSource§fn make_signature(&self) -> Signature
fn make_signature(&self) -> Signature
Signature with the default calling convention for
the TargetIsa, to which parameter and return types can be added for
declaring a function to be called by this Module.Source§fn clear_signature(&self, sig: &mut Signature)
fn clear_signature(&self, sig: &mut Signature)
Signature and reset for use with a new function. Read more