[−][src]Trait wasmer_clif_fork_wasm::ModuleEnvironment
An object satisfying the ModuleEnvironment
trait can be passed as argument to the
translate_module
function. These methods should not be called
by the user, they are only for wasmer-clif-fork-wasm
internal use.
Required methods
fn target_config(&self) -> TargetFrontendConfig
Get the information needed to produce Cranelift IR for the current target.
fn declare_signature(&mut self, sig: Signature)
Declares a function signature to the environment.
fn declare_func_import(
&mut self,
sig_index: SignatureIndex,
module: &'data str,
field: &'data str
)
&mut self,
sig_index: SignatureIndex,
module: &'data str,
field: &'data str
)
Declares a function import to the environment.
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: &'data str
)
&mut self,
table: Table,
module: &'data str,
field: &'data str
)
Declares a table import to the environment.
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: &'data str
)
&mut self,
memory: Memory,
module: &'data str,
field: &'data str
)
Declares a memory import to the environment.
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: &'data str
)
&mut self,
global: Global,
module: &'data str,
field: &'data str
)
Declares a global import to the environment.
fn declare_func_type(&mut self, sig_index: SignatureIndex)
Declares the type (signature) of a local function in the module.
fn declare_table(&mut self, table: Table)
Declares a table to the environment.
fn declare_memory(&mut self, memory: Memory)
Declares a memory to the environment
fn declare_global(&mut self, global: Global)
Declares a global to the environment.
fn get_global(&self, global_index: GlobalIndex) -> &Global
Return the global for the given global index.
fn declare_func_export(&mut self, func_index: FuncIndex, name: &'data str)
Declares a function export to the environment.
fn declare_table_export(&mut self, table_index: TableIndex, name: &'data str)
Declares a table export to the environment.
fn declare_memory_export(&mut self, memory_index: MemoryIndex, name: &'data str)
Declares a memory export to the environment.
fn declare_global_export(&mut self, global_index: GlobalIndex, name: &'data str)
Declares a global export to the environment.
fn declare_start_func(&mut self, index: FuncIndex)
Declares the optional start function.
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Box<[FuncIndex]>
)
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: Box<[FuncIndex]>
)
Fills a declared table with references to functions in the module.
fn define_function_body(
&mut self,
body_bytes: &'data [u8],
body_offset: usize
) -> WasmResult<()>
&mut self,
body_bytes: &'data [u8],
body_offset: usize
) -> WasmResult<()>
Provides the contents of a function body.
Note there's no reserve_function_bodies
function because the number of
functions is already provided by reserve_func_types
.
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
)
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: usize,
data: &'data [u8]
)
Fills a declared memory with bytes at module instantiation.
Provided methods
fn reserve_signatures(&mut self, _num: u32)
Provides the number of signatures up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_imports(&mut self, _num: u32)
Provides the number of imports up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn finish_imports(&mut self)
Notifies the implementation that all imports have been declared.
fn reserve_func_types(&mut self, _num: u32)
Provides the number of defined functions up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_tables(&mut self, _num: u32)
Provides the number of defined tables up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_memories(&mut self, _num: u32)
Provides the number of defined memories up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_globals(&mut self, _num: u32)
Provides the number of defined globals up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_exports(&mut self, _num: u32)
Provides the number of exports up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn finish_exports(&mut self)
Notifies the implementation that all exports have been declared.
fn reserve_table_elements(&mut self, _num: u32)
Provides the number of element initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
fn reserve_data_initializers(&mut self, _num: u32)
Provides the number of data initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired.
Implementors
impl<'data> ModuleEnvironment<'data> for DummyEnvironment
[src]
fn target_config(&self) -> TargetFrontendConfig
[src]
fn declare_signature(&mut self, sig: Signature)
[src]
fn declare_func_import(
&mut self,
sig_index: SignatureIndex,
module: &'data str,
field: &'data str
)
[src]
&mut self,
sig_index: SignatureIndex,
module: &'data str,
field: &'data str
)
fn declare_func_type(&mut self, sig_index: SignatureIndex)
[src]
fn declare_global(&mut self, global: Global)
[src]
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: &'data str
)
[src]
&mut self,
global: Global,
module: &'data str,
field: &'data str
)
fn get_global(&self, global_index: GlobalIndex) -> &Global
[src]
fn declare_table(&mut self, table: Table)
[src]
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: &'data str
)
[src]
&mut self,
table: Table,
module: &'data str,
field: &'data str
)
fn declare_table_elements(
&mut self,
_table_index: TableIndex,
_base: Option<GlobalIndex>,
_offset: usize,
_elements: Box<[FuncIndex]>
)
[src]
&mut self,
_table_index: TableIndex,
_base: Option<GlobalIndex>,
_offset: usize,
_elements: Box<[FuncIndex]>
)
fn declare_memory(&mut self, memory: Memory)
[src]
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: &'data str
)
[src]
&mut self,
memory: Memory,
module: &'data str,
field: &'data str
)
fn declare_data_initialization(
&mut self,
_memory_index: MemoryIndex,
_base: Option<GlobalIndex>,
_offset: usize,
_data: &'data [u8]
)
[src]
&mut self,
_memory_index: MemoryIndex,
_base: Option<GlobalIndex>,
_offset: usize,
_data: &'data [u8]
)
fn declare_func_export(&mut self, func_index: FuncIndex, name: &'data str)
[src]
fn declare_table_export(&mut self, table_index: TableIndex, name: &'data str)
[src]
fn declare_memory_export(&mut self, memory_index: MemoryIndex, name: &'data str)
[src]
fn declare_global_export(&mut self, global_index: GlobalIndex, name: &'data str)
[src]
fn declare_start_func(&mut self, func_index: FuncIndex)
[src]
fn define_function_body(
&mut self,
body_bytes: &'data [u8],
body_offset: usize
) -> WasmResult<()>
[src]
&mut self,
body_bytes: &'data [u8],
body_offset: usize
) -> WasmResult<()>