Struct cranelift_wasm::DummyEnvironment [−][src]
pub struct DummyEnvironment {
pub info: DummyModuleInfo,
pub func_bytecode_sizes: Vec<usize>,
pub module_name: Option<String>,
// some fields omitted
}
Expand description
This ModuleEnvironment
implementation is a “naïve” one, doing essentially nothing and
emitting placeholders when forced to. Don’t try to execute code translated for this
environment, essentially here for translation debug purposes.
Fields
info: DummyModuleInfo
Module information.
func_bytecode_sizes: Vec<usize>
Vector of wasm bytecode size for each function.
module_name: Option<String>
Name of the module from the wasm file.
Implementations
Creates a new DummyEnvironment
instance.
Return a DummyFuncEnvironment
for translating functions within this
DummyEnvironment
.
Return the number of imported functions within this DummyEnvironment
.
Return the name of the function, if a name for the function with the corresponding index exists.
Test reachability bits before and after every opcode during translation, as provided by the
FuncTranslationState
. This is generally used only for unit tests. This is applied to
every function in the module (so is likely only useful for test modules with one function).
Trait Implementations
Declares a function signature to the environment.
fn declare_func_import(
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_func_import(
&mut self,
index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares a function import to the environment.
Declares the type (signature) of a local function in the module.
Declares a global to the environment.
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_global_import(
&mut self,
global: Global,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares a global import to the environment.
Declares a table to the environment.
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_table_import(
&mut self,
table: Table,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares a table import to the environment.
fn declare_table_elements(
&mut self,
_table_index: TableIndex,
_base: Option<GlobalIndex>,
_offset: u32,
_elements: Box<[FuncIndex]>
) -> WasmResult<()>
fn declare_table_elements(
&mut self,
_table_index: TableIndex,
_base: Option<GlobalIndex>,
_offset: u32,
_elements: Box<[FuncIndex]>
) -> WasmResult<()>
Fills a declared table with references to functions in the module.
fn declare_passive_element(
&mut self,
_elem_index: ElemIndex,
_segments: Box<[FuncIndex]>
) -> WasmResult<()>
fn declare_passive_element(
&mut self,
_elem_index: ElemIndex,
_segments: Box<[FuncIndex]>
) -> WasmResult<()>
Declare a passive element segment.
fn declare_passive_data(
&mut self,
_elem_index: DataIndex,
_segments: &'data [u8]
) -> WasmResult<()>
fn declare_passive_data(
&mut self,
_elem_index: DataIndex,
_segments: &'data [u8]
) -> WasmResult<()>
Declare a passive data segment.
Declares a memory to the environment
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_memory_import(
&mut self,
memory: Memory,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares a memory import to the environment.
fn declare_data_initialization(
&mut self,
_memory_index: MemoryIndex,
_base: Option<GlobalIndex>,
_offset: u64,
_data: &'data [u8]
) -> WasmResult<()>
fn declare_data_initialization(
&mut self,
_memory_index: MemoryIndex,
_base: Option<GlobalIndex>,
_offset: u64,
_data: &'data [u8]
) -> WasmResult<()>
Fills a declared memory with bytes at module instantiation.
Declares a function export to the environment.
fn declare_table_export(
&mut self,
table_index: TableIndex,
name: &'data str
) -> WasmResult<()>
fn declare_table_export(
&mut self,
table_index: TableIndex,
name: &'data str
) -> WasmResult<()>
Declares a table export to the environment.
fn declare_memory_export(
&mut self,
memory_index: MemoryIndex,
name: &'data str
) -> WasmResult<()>
fn declare_memory_export(
&mut self,
memory_index: MemoryIndex,
name: &'data str
) -> WasmResult<()>
Declares a memory export to the environment.
fn declare_global_export(
&mut self,
global_index: GlobalIndex,
name: &'data str
) -> WasmResult<()>
fn declare_global_export(
&mut self,
global_index: GlobalIndex,
name: &'data str
) -> WasmResult<()>
Declares a global export to the environment.
Declares the optional start function.
fn define_function_body(
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
fn define_function_body(
&mut self,
validator: FuncValidator<ValidatorResources>,
body: FunctionBody<'data>
) -> WasmResult<()>
Provides the contents of a function body.
Declares the name of a module to the environment. Read more
Declares the name of a function to the environment. Read more
Returns the list of enabled wasm features this translation will be using.
Provides the number of types up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
fn declare_type_module(
&mut self,
imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
fn declare_type_module(
&mut self,
imports: &[(&'data str, Option<&'data str>, EntityType)],
exports: &[(&'data str, EntityType)]
) -> WasmResult<()>
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_tag_import(
&mut self,
tag: Tag,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_tag_import(
&mut self,
tag: Tag,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares an tag import to the environment.
fn declare_module_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_module_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares a module import to the environment.
fn declare_instance_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
fn declare_instance_import(
&mut self,
ty_index: TypeIndex,
module: &'data str,
field: Option<&'data str>
) -> WasmResult<()>
Declares an instance import to the environment.
Notifies the implementation that all imports have been declared.
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
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
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
Provides the number of defined tags up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more
Declares an tag 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
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 an tag export to the environment.
fn declare_instance_export(
&mut self,
index: InstanceIndex,
name: &'data str
) -> WasmResult<()>
fn declare_instance_export(
&mut self,
index: InstanceIndex,
name: &'data str
) -> WasmResult<()>
Declares an instance export to the environment.
Declares an instance export to the environment.
Notifies the implementation that all exports have been declared.
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
Indicates that a declarative element segment was seen in the wasm module. Read more
Provides the number of passive data segments up front. Read more
Indicates how many functions the code section reports and the byte offset of where the code sections starts. Read more
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_local_name(
&mut self,
_func_index: FuncIndex,
_local_index: u32,
_name: &'data str
)
fn declare_local_name(
&mut self,
_func_index: FuncIndex,
_local_index: u32,
_name: &'data str
)
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
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<()>
fn declare_instance(
&mut self,
module: ModuleIndex,
args: Vec<(&'data str, EntityIndex)>
) -> WasmResult<()>
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