Struct cranelift_jit::JITModule[][src]

pub struct JITModule { /* fields omitted */ }
Expand description

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

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 read_got_entry(&self, func_id: FuncId) -> *const u8

Returns the given function’s entry in the Global Offset Table.

Panics if there’s no entry in the table for the given function.

Returns the address of a finalized function.

The pointer remains valid until either JITModule::free_memory is called or in the future some way of deallocating this individual function is used.

Returns the address and size of a finalized data object.

The pointer remains valid until either JITModule::free_memory is called or in the future some way of deallocating this individual data object is used.

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.

Create a new JITModule.

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

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.

Use this when you’re building the IR of a function to reference a data object.

TODO: Same as above.

TODO: Same as above.

TODO: Same as above.

Return the TargetIsa to compile for.

Get all declarations in this module.

Declare a function in this module.

Declare an anonymous function in this module.

Declare a data object in this module.

Declare an anonymous data object in this module.

Define a function, producing the function body from the given Context. Read more

Define a function, taking the function body from the given bytes. Read more

Define a data object, producing the data contents from the given DataContext.

Get the module identifier for a given name, if that name has been declared. Read more

Return the target information needed by frontends to produce Cranelift IR for the current target. Read more

Create a new Context initialized for use with this Module. Read more

Clear the given Context and reset it for use with a new function. Read more

Create a new empty 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. Read more

Clear the given Signature and reset for use with a new function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.