Struct llvm::JitEngine [] [src]

pub struct JitEngine(_);

The MCJIT backend, which compiles functions and values into machine code.

Methods

impl<'a> JitEngine
[src]

fn with_function<C, A, R>(&self, function: &'a Function, cb: C) where A: Compile<'a>, R: Compile<'a>, C: FnOnce(extern 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.

unsafe fn with_function_unchecked<C, A, R>(&self, function: &'a Function, cb: C) where A: Compile<'a>, R: Compile<'a>, C: FnOnce(extern fn(A) -> R)

Run the closure cb with the machine code for the function function.

unsafe fn get_function<A, R>(&self, function: &'a Function) -> extern 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

impl Eq for JitEngine
[src]

impl PartialEq<JitEngine> for JitEngine
[src]

fn eq(&self, other: &JitEngine) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<'a> PartialEq<JitEngine> for &'a JitEngine
[src]

fn eq(&self, other: &JitEngine) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<'a> From<LLVMExecutionEngineRef> for &'a JitEngine
[src]

fn from(ty: LLVMExecutionEngineRef) -> &'a JitEngine

Performs the conversion.

impl<'a> From<LLVMExecutionEngineRef> for &'a mut JitEngine
[src]

fn from(ty: LLVMExecutionEngineRef) -> &'a mut JitEngine

Performs the conversion.

impl DisposeRef for JitEngine
[src]

type RefTo = LLVMOpaqueExecutionEngine

What a reference to this type represents as a C pointer.

unsafe fn dispose(ptr: *mut LLVMOpaqueExecutionEngine)

Destroy the contents at the pointer's location. Read more

impl<'a> ExecutionEngine<'a> for JitEngine
[src]

type Options = JitOptions

The options given to the engine upon creation.

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 more

fn add_module(&'a self, module: &'a Module)

Add a module to the list of modules to interpret or compile.

fn remove_module(&'a self, module: &'a Module) -> &'a Module

Remove a module from the list of modules to interpret or compile.

fn run_static_constructors(&'a self)

Execute all of the static constructors for this program.

fn run_static_destructors(&'a self)

Execute all of the static destructors for this program.

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 more

fn run_function(&'a self, function: &'a Function, args: &[GenericValue<'a>]) -> GenericValue<'a>

Run function with the arguments given as `GenericValues, then return the result as one. Read more

unsafe fn get_global<T>(&'a self, global: &'a Value) -> &'a T

Returns a pointer to the global value given. Read more

unsafe fn find_global<T>(&'a self, name: &str) -> Option<&'a T>

Returns a pointer to the global value with the name given. Read more