pub struct JitEngine(_);Expand description
The MCJIT backend, which compiles functions and values into machine code.
Implementations§
source§impl<'a> JitEngine
impl<'a> JitEngine
sourcepub fn with_function<C, A, R>(&self, function: &'a Function, cb: C)where
A: Compile<'a>,
R: Compile<'a>,
C: FnOnce(extern "C" fn(_: A) -> R),
pub fn with_function<C, A, R>(&self, function: &'a Function, cb: C)where
A: Compile<'a>,
R: Compile<'a>,
C: FnOnce(extern "C" fn(_: A) -> R),
Run the closure cb with the machine code for the function function.
If the function takes multiple arguments, these should be wrapped in a tuple due to the limitations of Rust’s type system.
This will check that the types match at runtime when in debug mode, but not release mode. You should make sure to use debug mode if you want it to error when the types don’t match.
sourcepub unsafe fn with_function_unchecked<C, A, R>(
&self,
function: &'a Function,
cb: C
)where
A: Compile<'a>,
R: Compile<'a>,
C: FnOnce(extern "C" fn(_: A) -> R),
pub unsafe fn with_function_unchecked<C, A, R>(
&self,
function: &'a Function,
cb: C
)where
A: Compile<'a>,
R: Compile<'a>,
C: FnOnce(extern "C" fn(_: A) -> R),
Run the closure cb with the machine code for the function function.
sourcepub unsafe fn get_function<A, R>(
&self,
function: &'a Function
) -> extern "C" fn(_: A) -> R
pub unsafe fn get_function<A, R>(
&self,
function: &'a Function
) -> extern "C" fn(_: A) -> R
Returns a pointer to the machine code for the function function.
This is marked as unsafe because the types given as arguments and return could be different from their internal representation.
Trait Implementations§
source§impl DisposeRef for JitEngine
impl DisposeRef for JitEngine
§type RefTo = LLVMOpaqueExecutionEngine
type RefTo = LLVMOpaqueExecutionEngine
What a reference to this type represents as a C pointer.
source§impl<'a> ExecutionEngine<'a> for JitEngine
impl<'a> ExecutionEngine<'a> for JitEngine
§type Options = JitOptions
type Options = JitOptions
The options given to the engine upon creation.
source§fn new(
module: &'a Module,
options: JitOptions
) -> Result<CSemiBox<'a, JitEngine>, CBox<str>>
fn new(
module: &'a Module,
options: JitOptions
) -> Result<CSemiBox<'a, JitEngine>, CBox<str>>
Create a new execution engine with the given
Module and optiions, or return a
description of the error. Read moresource§fn add_module(&'a self, module: &'a Module)
fn add_module(&'a self, module: &'a Module)
Add a module to the list of modules to interpret or compile.
source§fn remove_module(&'a self, module: &'a Module) -> &'a Module
fn remove_module(&'a self, module: &'a Module) -> &'a Module
Remove a module from the list of modules to interpret or compile.
source§fn run_static_constructors(&'a self)
fn run_static_constructors(&'a self)
Execute all of the static constructors for this program.
source§fn run_static_destructors(&'a self)
fn run_static_destructors(&'a self)
Execute all of the static destructors for this program.
source§fn find_function(&'a self, name: &str) -> Option<&'a Function>
fn find_function(&'a self, name: &str) -> Option<&'a Function>
Attempt to find a function with the name given, or
None if there wasn’t
a function with that name. Read moresource§fn run_function(
&'a self,
function: &'a Function,
args: &[&'a GenericValue]
) -> &'a GenericValue
fn run_function(
&'a self,
function: &'a Function,
args: &[&'a GenericValue]
) -> &'a GenericValue
Run
function with the arguments given as ``GenericValue`s, then return the result as one. Read moresource§impl<'a> From<&'a JitEngine> for LLVMExecutionEngineRef
impl<'a> From<&'a JitEngine> for LLVMExecutionEngineRef
source§fn from(ty: &'a JitEngine) -> LLVMExecutionEngineRef
fn from(ty: &'a JitEngine) -> LLVMExecutionEngineRef
Converts to this type from the input type.
source§impl<'a> From<&'a mut JitEngine> for LLVMExecutionEngineRef
impl<'a> From<&'a mut JitEngine> for LLVMExecutionEngineRef
source§fn from(ty: &'a mut JitEngine) -> LLVMExecutionEngineRef
fn from(ty: &'a mut JitEngine) -> LLVMExecutionEngineRef
Converts to this type from the input type.
source§impl<'a> From<*mut LLVMOpaqueExecutionEngine> for &'a JitEngine
impl<'a> From<*mut LLVMOpaqueExecutionEngine> for &'a JitEngine
source§fn from(ty: LLVMExecutionEngineRef) -> &'a JitEngine
fn from(ty: LLVMExecutionEngineRef) -> &'a JitEngine
Converts to this type from the input type.
source§impl<'a> From<*mut LLVMOpaqueExecutionEngine> for &'a mut JitEngine
impl<'a> From<*mut LLVMOpaqueExecutionEngine> for &'a mut JitEngine
source§fn from(ty: LLVMExecutionEngineRef) -> &'a mut JitEngine
fn from(ty: LLVMExecutionEngineRef) -> &'a mut JitEngine
Converts to this type from the input type.