Struct wasmtime_environ::ModuleEnvironment [−][src]
pub struct ModuleEnvironment<'data, 'module> { pub isa: &'module TargetIsa, pub module: &'module mut Module, pub lazy: LazyContents<'data>, }
Object containing the standalone environment information. To be passed after creation as
argument to compile_module
.
Fields
isa: &'module TargetIsa
Compilation setting flags.
module: &'module mut Module
Module information.
lazy: LazyContents<'data>
References to information to be decoded later.
Methods
impl<'data, 'module> ModuleEnvironment<'data, 'module>
[src]
impl<'data, 'module> ModuleEnvironment<'data, 'module>
pub fn new(isa: &'module TargetIsa, module: &'module mut Module) -> Self
[src]
pub fn new(isa: &'module TargetIsa, module: &'module mut Module) -> Self
Allocates the enironment data structures with the given isa.
pub fn translate(
self,
data: &'data [u8]
) -> WasmResult<ModuleTranslation<'data, 'module>>
[src]
pub fn translate(
self,
data: &'data [u8]
) -> WasmResult<ModuleTranslation<'data, 'module>>
Translate the given wasm module data using this environment. This consumes the
ModuleEnvironment
with its mutable reference to the Module
and produces a
ModuleTranslation
with an immutable reference to the Module
(which has
become fully populated).
Trait Implementations
impl<'data, 'module> ModuleEnvironment<'data> for ModuleEnvironment<'data, 'module>
[src]
impl<'data, 'module> ModuleEnvironment<'data> for ModuleEnvironment<'data, 'module>
This trait is useful for translate_module
because it tells how to translate
enironment-dependent wasm instructions. These functions should not be called by the user.
fn get_func_name(&self, func_index: FunctionIndex) -> ExternalName
[src]
fn get_func_name(&self, func_index: FunctionIndex) -> ExternalName
Return the name for the given function index.
fn flags(&self) -> &Flags
[src]
fn flags(&self) -> &Flags
Get the flags for the current compilation.
fn declare_signature(&mut self, sig: &Signature)
[src]
fn declare_signature(&mut self, sig: &Signature)
Declares a function signature to the environment.
fn get_signature(&self, sig_index: SignatureIndex) -> &Signature
[src]
fn get_signature(&self, sig_index: SignatureIndex) -> &Signature
Return the signature with the given index.
fn declare_func_import(
&mut self,
sig_index: SignatureIndex,
module: &str,
field: &str
)
[src]
fn declare_func_import(
&mut self,
sig_index: SignatureIndex,
module: &str,
field: &str
)
Declares a function import to the environment.
fn get_num_func_imports(&self) -> usize
[src]
fn get_num_func_imports(&self) -> usize
Return the number of imported funcs.
fn declare_func_type(&mut self, sig_index: SignatureIndex)
[src]
fn declare_func_type(&mut self, sig_index: SignatureIndex)
Declares the type (signature) of a local function in the module.
fn get_func_type(&self, func_index: FunctionIndex) -> SignatureIndex
[src]
fn get_func_type(&self, func_index: FunctionIndex) -> SignatureIndex
Return the signature index for the given function index.
fn declare_global(&mut self, global: Global)
[src]
fn declare_global(&mut self, global: Global)
Declares a global to the environment.
fn get_global(&self, global_index: GlobalIndex) -> &Global
[src]
fn get_global(&self, global_index: GlobalIndex) -> &Global
Return the global for the given global index.
fn declare_table(&mut self, table: Table)
[src]
fn declare_table(&mut self, table: Table)
Declares a table to the environment.
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Vec<FunctionIndex>
)
[src]
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Vec<FunctionIndex>
)
Fills a declared table with references to functions in the module.
fn declare_memory(&mut self, memory: Memory)
[src]
fn declare_memory(&mut self, memory: Memory)
Declares a memory to the environment
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
)
[src]
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
)
Fills a declared memory with bytes at module instantiation.
fn declare_func_export(&mut self, func_index: FunctionIndex, name: &str)
[src]
fn declare_func_export(&mut self, func_index: FunctionIndex, name: &str)
Declares a function export to the environment.
fn declare_table_export(&mut self, table_index: TableIndex, name: &str)
[src]
fn declare_table_export(&mut self, table_index: TableIndex, name: &str)
Declares a table export to the environment.
fn declare_memory_export(&mut self, memory_index: MemoryIndex, name: &str)
[src]
fn declare_memory_export(&mut self, memory_index: MemoryIndex, name: &str)
Declares a memory export to the environment.
fn declare_global_export(&mut self, global_index: GlobalIndex, name: &str)
[src]
fn declare_global_export(&mut self, global_index: GlobalIndex, name: &str)
Declares a global export to the environment.
fn declare_start_func(&mut self, func_index: FunctionIndex)
[src]
fn declare_start_func(&mut self, func_index: FunctionIndex)
Declares a start function.
fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()>
[src]
fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()>
Provides the contents of a function body.
Auto Trait Implementations
impl<'data, 'module> !Send for ModuleEnvironment<'data, 'module>
impl<'data, 'module> !Send for ModuleEnvironment<'data, 'module>
impl<'data, 'module> !Sync for ModuleEnvironment<'data, 'module>
impl<'data, 'module> !Sync for ModuleEnvironment<'data, 'module>