Struct cranelift_jit::JITModule[][src]

pub struct JITModule { /* fields omitted */ }

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]

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 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]

TODO: Same as above.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.