Struct wasmer_compiler::translator::environ::ModuleEnvironment
source · pub struct ModuleEnvironment<'data> {
pub module: ModuleInfo,
pub function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'data>>,
pub data_initializers: Vec<DataInitializer<'data>>,
pub module_translation_state: Option<ModuleTranslationState>,
}
Expand description
The result of translating via ModuleEnvironment
. Function bodies are not
yet translated, and data initializers have not yet been copied out of the
original buffer.
The function bodies will be translated by a specific compiler backend.
Fields§
§module: ModuleInfo
ModuleInfo information.
function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'data>>
References to the function bodies.
data_initializers: Vec<DataInitializer<'data>>
References to the data initializers.
module_translation_state: Option<ModuleTranslationState>
The decoded Wasm types for the module.
Implementations§
source§impl<'data> ModuleEnvironment<'data>
impl<'data> ModuleEnvironment<'data>
sourcepub fn translate(self, data: &'data [u8]) -> WasmResult<Self>
pub fn translate(self, data: &'data [u8]) -> WasmResult<Self>
Translate a wasm module using this environment. This consumes the
ModuleEnvironment
and produces a ModuleInfoTranslation
.
pub(crate) fn declare_export( &mut self, export: ExportIndex, name: &str, ) -> WasmResult<()>
pub(crate) fn declare_import( &mut self, import: ImportIndex, module: &str, field: &str, ) -> WasmResult<()>
pub(crate) fn reserve_signatures(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_signature(&mut self, sig: FunctionType) -> WasmResult<()>
pub(crate) fn declare_func_import( &mut self, sig_index: SignatureIndex, module: &str, field: &str, ) -> WasmResult<()>
pub(crate) fn declare_table_import( &mut self, table: TableType, module: &str, field: &str, ) -> WasmResult<()>
pub(crate) fn declare_memory_import( &mut self, memory: MemoryType, module: &str, field: &str, ) -> WasmResult<()>
pub(crate) fn declare_global_import( &mut self, global: GlobalType, module: &str, field: &str, ) -> WasmResult<()>
pub(crate) fn finish_imports(&mut self) -> WasmResult<()>
pub(crate) fn reserve_func_types(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_func_type( &mut self, sig_index: SignatureIndex, ) -> WasmResult<()>
pub(crate) fn reserve_tables(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_table(&mut self, table: TableType) -> WasmResult<()>
pub(crate) fn reserve_memories(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_memory(&mut self, memory: MemoryType) -> WasmResult<()>
pub(crate) fn reserve_globals(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_global( &mut self, global: GlobalType, initializer: GlobalInit, ) -> WasmResult<()>
pub(crate) fn reserve_exports(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_func_export( &mut self, func_index: FunctionIndex, name: &str, ) -> WasmResult<()>
pub(crate) fn declare_table_export( &mut self, table_index: TableIndex, name: &str, ) -> WasmResult<()>
pub(crate) fn declare_memory_export( &mut self, memory_index: MemoryIndex, name: &str, ) -> WasmResult<()>
pub(crate) fn declare_global_export( &mut self, global_index: GlobalIndex, name: &str, ) -> WasmResult<()>
pub(crate) fn declare_start_function( &mut self, func_index: FunctionIndex, ) -> WasmResult<()>
pub(crate) fn reserve_table_initializers(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_table_initializers( &mut self, table_index: TableIndex, base: Option<GlobalIndex>, offset: usize, elements: Box<[FunctionIndex]>, ) -> WasmResult<()>
pub(crate) fn declare_passive_element( &mut self, elem_index: ElemIndex, segments: Box<[FunctionIndex]>, ) -> WasmResult<()>
pub(crate) fn define_function_body( &mut self, _module_translation_state: &ModuleTranslationState, body_bytes: &'data [u8], body_offset: usize, ) -> WasmResult<()>
pub(crate) fn reserve_data_initializers(&mut self, num: u32) -> WasmResult<()>
pub(crate) fn declare_data_initialization( &mut self, memory_index: MemoryIndex, base: Option<GlobalIndex>, offset: usize, data: &'data [u8], ) -> WasmResult<()>
pub(crate) fn reserve_passive_data(&mut self, count: u32) -> WasmResult<()>
pub(crate) fn declare_passive_data( &mut self, data_index: DataIndex, data: &'data [u8], ) -> WasmResult<()>
pub(crate) fn declare_module_name(&mut self, name: &'data str) -> WasmResult<()>
pub(crate) fn declare_function_name( &mut self, func_index: FunctionIndex, name: &'data str, ) -> WasmResult<()>
sourcepub(crate) fn reserve_imports(&mut self, _num: u32) -> WasmResult<()>
pub(crate) fn reserve_imports(&mut self, _num: u32) -> WasmResult<()>
Provides the number of imports up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
sourcepub(crate) fn finish_exports(&mut self) -> WasmResult<()>
pub(crate) fn finish_exports(&mut self) -> WasmResult<()>
Notifies the implementation that all exports have been declared.
sourcepub(crate) fn custom_section(
&mut self,
name: &'data str,
data: &'data [u8],
) -> WasmResult<()>
pub(crate) fn custom_section( &mut self, name: &'data str, data: &'data [u8], ) -> WasmResult<()>
Indicates that a custom section has been found in the wasm file