Struct wasmtime_environ::wasm::DummyEnvironment[][src]

pub struct DummyEnvironment {
    pub info: DummyModuleInfo,
    pub func_bytecode_sizes: Vec<usize, Global>,
    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, Global>

Vector of wasm bytecode size for each function.

module_name: Option<String>

Name of the module from the wasm file.

Implementations

impl DummyEnvironment[src]

pub fn new(
    config: TargetFrontendConfig,
    return_mode: ReturnMode,
    debug_info: bool
) -> DummyEnvironment
[src]

Creates a new DummyEnvironment instance.

pub fn func_env(&self) -> DummyFuncEnvironment<'_>[src]

Return a DummyFuncEnvironment for translating functions within this DummyEnvironment.

pub fn get_num_func_imports(&self) -> usize[src]

Return the number of imported functions within this DummyEnvironment.

pub fn get_func_name(&self, func_index: FuncIndex) -> Option<&str>[src]

Return the name of the function, if a name for the function with the corresponding index exists.

pub fn test_expected_reachability(
    &mut self,
    reachability: Vec<(bool, bool), Global>
)
[src]

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

impl<'data> ModuleEnvironment<'data> for DummyEnvironment[src]

pub fn declare_type_func(&mut self, wasm: WasmFuncType) -> Result<(), WasmError>[src]

Declares a function signature to the environment.

pub fn declare_func_import(
    &mut self,
    index: TypeIndex,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares a function import to the environment.

pub fn declare_func_type(&mut self, index: TypeIndex) -> Result<(), WasmError>[src]

Declares the type (signature) of a local function in the module.

pub fn declare_global(&mut self, global: Global) -> Result<(), WasmError>[src]

Declares a global to the environment.

pub fn declare_global_import(
    &mut self,
    global: Global,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares a global import to the environment.

pub fn declare_table(&mut self, table: Table) -> Result<(), WasmError>[src]

Declares a table to the environment.

pub fn declare_table_import(
    &mut self,
    table: Table,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares a table import to the environment.

pub fn declare_table_elements(
    &mut self,
    _table_index: TableIndex,
    _base: Option<GlobalIndex>,
    _offset: u32,
    _elements: Box<[FuncIndex], Global>
) -> Result<(), WasmError>
[src]

Fills a declared table with references to functions in the module.

pub fn declare_passive_element(
    &mut self,
    _elem_index: ElemIndex,
    _segments: Box<[FuncIndex], Global>
) -> Result<(), WasmError>
[src]

Declare a passive element segment.

pub fn declare_passive_data(
    &mut self,
    _elem_index: DataIndex,
    _segments: &'data [u8]
) -> Result<(), WasmError>
[src]

Declare a passive data segment.

pub fn declare_memory(&mut self, memory: Memory) -> Result<(), WasmError>[src]

Declares a memory to the environment

pub fn declare_memory_import(
    &mut self,
    memory: Memory,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares a memory import to the environment.

pub fn declare_data_initialization(
    &mut self,
    _memory_index: MemoryIndex,
    _base: Option<GlobalIndex>,
    _offset: u32,
    _data: &'data [u8]
) -> Result<(), WasmError>
[src]

Fills a declared memory with bytes at module instantiation.

pub fn declare_func_export(
    &mut self,
    func_index: FuncIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares a function export to the environment.

pub fn declare_table_export(
    &mut self,
    table_index: TableIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares a table export to the environment.

pub fn declare_memory_export(
    &mut self,
    memory_index: MemoryIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares a memory export to the environment.

pub fn declare_global_export(
    &mut self,
    global_index: GlobalIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares a global export to the environment.

pub fn declare_start_func(
    &mut self,
    func_index: FuncIndex
) -> Result<(), WasmError>
[src]

Declares the optional start function.

pub fn define_function_body(
    &mut self,
    validator: FuncValidator<ValidatorResources>,
    body: FunctionBody<'data>
) -> Result<(), WasmError>
[src]

Provides the contents of a function body.

pub fn declare_module_name(&mut self, name: &'data str)[src]

Declares the name of a module to the environment. Read more

pub fn declare_func_name(&mut self, func_index: FuncIndex, name: &'data str)[src]

Declares the name of a function to the environment. Read more

pub fn wasm_features(&self) -> WasmFeatures[src]

Returns the list of enabled wasm features this translation will be using.

fn reserve_types(&mut self, _num: u32) -> Result<(), WasmError>[src]

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)]
) -> Result<(), WasmError>
[src]

Declares a module type signature to the environment.

fn declare_type_instance(
    &mut self,
    exports: &[(&'data str, EntityType)]
) -> Result<(), WasmError>
[src]

Declares an instance type signature to the environment.

fn type_to_signature(
    &self,
    index: TypeIndex
) -> Result<SignatureIndex, WasmError>
[src]

Translates a type index to its signature index, only called for type indices which point to functions. Read more

fn type_to_module_type(
    &self,
    index: TypeIndex
) -> Result<ModuleTypeIndex, WasmError>
[src]

Translates a type index to its module type index, only called for type indices which point to modules. Read more

fn type_to_instance_type(
    &self,
    index: TypeIndex
) -> Result<InstanceTypeIndex, WasmError>
[src]

Translates a type index to its instance type index, only called for type indices which point to instances. Read more

fn reserve_imports(&mut self, _num: u32) -> Result<(), WasmError>[src]

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_event_import(
    &mut self,
    event: Event,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares an event import to the environment.

fn declare_module_import(
    &mut self,
    ty_index: TypeIndex,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares a module import to the environment.

fn declare_instance_import(
    &mut self,
    ty_index: TypeIndex,
    module: &'data str,
    field: Option<&'data str>
) -> Result<(), WasmError>
[src]

Declares an instance import to the environment.

fn finish_imports(&mut self) -> Result<(), WasmError>[src]

Notifies the implementation that all imports have been declared.

fn reserve_func_types(&mut self, _num: u32) -> Result<(), WasmError>[src]

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

fn reserve_tables(&mut self, _num: u32) -> Result<(), WasmError>[src]

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

fn reserve_memories(&mut self, _num: u32) -> Result<(), WasmError>[src]

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

fn reserve_events(&mut self, _num: u32) -> Result<(), WasmError>[src]

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

fn declare_event(&mut self, event: Event) -> Result<(), WasmError>[src]

Declares an event to the environment

fn reserve_globals(&mut self, _num: u32) -> Result<(), WasmError>[src]

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

fn reserve_exports(&mut self, _num: u32) -> Result<(), WasmError>[src]

Provides the number of exports up front. By default this does nothing, but implementations can use this to preallocate memory if desired. Read more

fn declare_event_export(
    &mut self,
    event_index: EventIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares an event export to the environment.

fn declare_instance_export(
    &mut self,
    index: InstanceIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares an instance export to the environment.

fn declare_module_export(
    &mut self,
    index: ModuleIndex,
    name: &'data str
) -> Result<(), WasmError>
[src]

Declares an instance export to the environment.

fn finish_exports(&mut self) -> Result<(), WasmError>[src]

Notifies the implementation that all exports have been declared.

fn reserve_table_elements(&mut self, _num: u32) -> Result<(), WasmError>[src]

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_elements(
    &mut self,
    elements: Box<[FuncIndex], Global>
) -> Result<(), WasmError>
[src]

Indicates that a declarative element segment was seen in the wasm module. Read more

fn reserve_passive_data(&mut self, count: u32) -> Result<(), WasmError>[src]

Provides the number of passive data segments up front. Read more

fn reserve_function_bodies(&mut self, bodies: u32, code_section_offset: u64)[src]

Indicates how many functions the code section reports and the byte offset of where the code sections starts. Read more

fn reserve_data_initializers(&mut self, _num: u32) -> Result<(), WasmError>[src]

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
)
[src]

Declares the name of a function’s local to the environment. Read more

fn custom_section(
    &mut self,
    _name: &'data str,
    _data: &'data [u8]
) -> Result<(), WasmError>
[src]

Indicates that a custom section has been found in the wasm file

fn reserve_modules(&mut self, amount: u32)[src]

Indicates that this module will have amount submodules. Read more

fn module_start(&mut self)[src]

Called at the beginning of translating a module. Read more

fn module_end(&mut self)[src]

Called at the end of translating a module. Read more

fn reserve_instances(&mut self, amount: u32)[src]

Indicates that this module will have amount instances.

fn declare_instance(
    &mut self,
    module: ModuleIndex,
    args: Vec<(&'data str, EntityIndex), Global>
) -> Result<(), WasmError>
[src]

Declares a new instance which this module will instantiate before it’s instantiated. Read more

fn declare_alias(&mut self, alias: Alias<'data>) -> Result<(), WasmError>[src]

Declares a new alias being added to this module. Read more

impl TargetEnvironment for DummyEnvironment[src]

pub fn target_config(&self) -> TargetFrontendConfig[src]

Get the information needed to produce Cranelift IR for the given target.

fn pointer_type(&self) -> Type[src]

Get the Cranelift integer type to use for native pointers. Read more

fn pointer_bytes(&self) -> u8[src]

Get the size of a native pointer, in bytes.

fn reference_type(&self, ty: WasmType) -> Type[src]

Get the Cranelift reference type to use for the given Wasm reference type. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.