Struct wasmtime_environ::ModuleEnvironment [−][src]
pub struct ModuleEnvironment<'data> { /* fields omitted */ }
Expand description
Object containing the standalone environment information.
Implementations
pub fn new(
target_config: TargetFrontendConfig,
tunables: &Tunables,
features: &WasmFeatures
) -> Self
[src]
pub fn new(
target_config: TargetFrontendConfig,
tunables: &Tunables,
features: &WasmFeatures
) -> Self
[src]Allocates the environment data structures.
pub fn translate(
self,
data: &'data [u8]
) -> WasmResult<(usize, Vec<ModuleTranslation<'data>>, TypeTables)>
[src]
pub fn translate(
self,
data: &'data [u8]
) -> WasmResult<(usize, Vec<ModuleTranslation<'data>>, TypeTables)>
[src]Translate a wasm module using this environment.
This consumes the ModuleEnvironment
and produces a list of
ModuleTranslation
s as well as a TypeTables
. The list of module
translations corresponds to all wasm modules found in the input data
.
Note that for MVP modules this will always be a list with one element,
but with the module linking proposal this may have many elements.
For the module linking proposal the top-level module is returned as the first return value.
The TypeTables
structure returned contains intern’d versions of types
referenced from each module translation. This primarily serves as the
source of truth for module-linking use cases where modules can refer to
other module’s types. All SignatureIndex
, ModuleTypeIndex
, and
InstanceTypeIndex
values are resolved through the returned tables.
Trait Implementations
This trait is useful for translate_module
because it tells how to translate
environment-dependent wasm instructions. These functions should not be called by the user.
Provides the number of types up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares a function signature to the environment.
fn declare_type_module(
&mut self,
declared_imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
[src]
fn declare_type_module(
&mut self,
declared_imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
[src]Declares a module type signature to the environment.
Declares an instance type signature to the environment.
Translates a type index to its signature index, only called for type indices which point to functions. Read more
Translates a type index to its module type index, only called for type indices which point to modules. Read more
Translates a type index to its instance type index, only called for type indices which point to instances. Read more
Provides the number of imports up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
fn declare_func_import(
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_func_import(
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares a function import to the environment.
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares a table import to the environment.
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares a memory import to the environment.
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares a global import to the environment.
fn declare_module_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_module_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares a module import to the environment.
fn declare_instance_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]
fn declare_instance_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
[src]Declares an instance import to the environment.
Provides the number of defined functions up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares the type (signature) of a local function in the module.
Provides the number of defined tables up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares a table to the environment.
Provides the number of defined memories up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares a memory to the environment
Provides the number of defined globals up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares a global to the environment.
Provides the number of exports up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares a function export to the environment.
Declares a table export to the environment.
Declares a memory export to the environment.
Declares a global export to the environment.
Declares an instance export to the environment.
Declares an instance export to the environment.
Declares the optional start function.
Provides the number of element initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: u32,
elements: Box<[FuncIndex]>
) -> WasmResult<()>
[src]
fn declare_table_elements(
&mut self,
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: u32,
elements: Box<[FuncIndex]>
) -> WasmResult<()>
[src]Fills a declared table with references to functions in the module.
fn declare_passive_element(
&mut self,
elem_index: ElemIndex,
segments: Box<[FuncIndex]>
) -> WasmResult<()>
[src]
fn declare_passive_element(
&mut self,
elem_index: ElemIndex,
segments: Box<[FuncIndex]>
) -> WasmResult<()>
[src]Declare a passive element segment.
Indicates that a declarative element segment was seen in the wasm module. Read more
Indicates how many functions the code section reports and the byte offset of where the code sections starts. Read more
fn define_function_body(
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
[src]
fn define_function_body(
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
[src]Provides the contents of a function body.
Provides the number of data initializers up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: u32,
data: &'data [u8]
) -> WasmResult<()>
[src]
fn declare_data_initialization(
&mut self,
memory_index: MemoryIndex,
base: Option<GlobalIndex>,
offset: u32,
data: &'data [u8]
) -> WasmResult<()>
[src]Fills a declared memory with bytes at module instantiation.
Provides the number of passive data segments up front. Read more
fn declare_passive_data(
&mut self,
data_index: DataIndex,
data: &'data [u8]
) -> WasmResult<()>
[src]
fn declare_passive_data(
&mut self,
data_index: DataIndex,
data: &'data [u8]
) -> WasmResult<()>
[src]Declare a passive data segment.
Declares the name of a module to the environment. Read more
Declares the name of a function to the environment. Read more
Declares the name of a function’s local to the environment. Read more
Indicates that a custom section has been found in the wasm file
Returns the list of enabled wasm features this translation will be using.
Indicates that this module will have amount
submodules. Read more
Called at the beginning of translating a module. Read more
Called at the end of translating a module. Read more
Indicates that this module will have amount
instances.
fn declare_instance(
&mut self,
module: ModuleIndex,
args: Vec<(&'data str, EntityIndex)>
) -> WasmResult<()>
[src]
fn declare_instance(
&mut self,
module: ModuleIndex,
args: Vec<(&'data str, EntityIndex)>
) -> WasmResult<()>
[src]Declares a new instance which this module will instantiate before it’s instantiated. Read more
Declares a new alias being added to this module. Read more
Declares an event import to the environment.
Notifies the implementation that all imports have been declared.
Provides the number of defined events up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares an event to the environment
fn declare_event_export(
&mut self,
event_index: EventIndex,
name: &'data str
) -> Result<(), WasmError>
[src]
fn declare_event_export(
&mut self,
event_index: EventIndex,
name: &'data str
) -> Result<(), WasmError>
[src]Declares an event export to the environment.
Notifies the implementation that all exports have been declared.
Auto Trait Implementations
impl<'data> RefUnwindSafe for ModuleEnvironment<'data>
impl<'data> Send for ModuleEnvironment<'data>
impl<'data> Sync for ModuleEnvironment<'data>
impl<'data> Unpin for ModuleEnvironment<'data>
impl<'data> UnwindSafe for ModuleEnvironment<'data>