Struct cranelift_wasm::DummyFuncEnvironment

source ·
pub struct DummyFuncEnvironment<'dummy_environment> {
    pub mod_info: &'dummy_environment DummyModuleInfo,
    pub heaps: PrimaryMap<Heap, HeapData>,
    /* private fields */
}
Expand description

The FuncEnvironment implementation for use by the DummyEnvironment.

Fields§

§mod_info: &'dummy_environment DummyModuleInfo

This function environment’s module info.

§heaps: PrimaryMap<Heap, HeapData>

Heaps we have created to implement Wasm linear memories.

Implementations§

source§

impl<'dummy_environment> DummyFuncEnvironment<'dummy_environment>

source

pub fn new( mod_info: &'dummy_environment DummyModuleInfo, expected_reachability: Option<ExpectedReachability> ) -> Self

Construct a new DummyFuncEnvironment.

source

pub fn vmctx_sig(&self, sigidx: TypeIndex) -> Signature

Create a signature for sigidx amended with a vmctx argument after the standard wasm arguments.

Trait Implementations§

source§

impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environment>

source§

fn make_global( &mut self, func: &mut Function, index: GlobalIndex ) -> WasmResult<GlobalVariable>

Set up the necessary preamble definitions in func to access the global variable identified by index. Read more
source§

fn heaps(&self) -> &PrimaryMap<Heap, HeapData>

Get the heaps for this function environment. Read more
source§

fn make_heap( &mut self, func: &mut Function, _index: MemoryIndex ) -> WasmResult<Heap>

Set up the necessary preamble definitions in func to access the linear memory identified by index. Read more
source§

fn make_table( &mut self, func: &mut Function, _index: TableIndex ) -> WasmResult<Table>

Set up the necessary preamble definitions in func to access the table identified by index. Read more
source§

fn make_indirect_sig( &mut self, func: &mut Function, index: TypeIndex ) -> WasmResult<SigRef>

Set up a signature definition in the preamble of func that can be used for an indirect call with signature index. Read more
source§

fn make_direct_func( &mut self, func: &mut Function, index: FuncIndex ) -> WasmResult<FuncRef>

Set up an external function definition in the preamble of func that can be used to directly call the function index. Read more
source§

fn before_translate_operator( &mut self, _op: &Operator<'_>, _builder: &mut FunctionBuilder<'_>, state: &FuncTranslationState ) -> WasmResult<()>

Optional callback for the FunctionEnvironment performing this translation to maintain internal state or prepare custom state for the operator to translate
source§

fn after_translate_operator( &mut self, _op: &Operator<'_>, _builder: &mut FunctionBuilder<'_>, state: &FuncTranslationState ) -> WasmResult<()>

Optional callback for the FunctionEnvironment performing this translation to maintain internal state or finalize custom state for the operator that was translated
source§

fn after_translate_function( &mut self, _builder: &mut FunctionBuilder<'_>, _state: &FuncTranslationState ) -> WasmResult<()>

Optional callback for the FunctionEnvironment performing this translation to perform work after the function body is translated.
source§

fn translate_call_indirect( &mut self, builder: &mut FunctionBuilder<'_>, _table_index: TableIndex, _table: Table, _sig_index: TypeIndex, sig_ref: SigRef, callee: Value, call_args: &[Value] ) -> WasmResult<Inst>

Translate a call_indirect WebAssembly instruction at pos. Read more
source§

fn translate_return_call_indirect( &mut self, _builder: &mut FunctionBuilder<'_>, _table_index: TableIndex, _table: Table, _sig_index: TypeIndex, _sig_ref: SigRef, _callee: Value, _call_args: &[Value] ) -> WasmResult<()>

Translate a return_call_indirect WebAssembly instruction at the builder’s current position. Read more
source§

fn translate_return_call_ref( &mut self, _builder: &mut FunctionBuilder<'_>, _sig_ref: SigRef, _callee: Value, _call_args: &[Value] ) -> WasmResult<()>

Translate a return_call_ref WebAssembly instruction at the builder’s given position. Read more
source§

fn translate_call( &mut self, builder: &mut FunctionBuilder<'_>, _callee_index: FuncIndex, callee: FuncRef, call_args: &[Value] ) -> WasmResult<Inst>

Translate a call WebAssembly instruction at pos. Read more
source§

fn translate_call_ref( &mut self, _builder: &mut FunctionBuilder<'_>, _sig_ref: SigRef, _callee: Value, _call_args: &[Value] ) -> WasmResult<Inst>

Translate a call_ref WebAssembly instruction at the builder’s current position. Read more
source§

fn translate_memory_grow( &mut self, pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap, _val: Value ) -> WasmResult<Value>

Translate a memory.grow WebAssembly instruction. Read more
source§

fn translate_memory_size( &mut self, pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap ) -> WasmResult<Value>

Translates a memory.size WebAssembly instruction. Read more
source§

fn translate_memory_copy( &mut self, _pos: FuncCursor<'_>, _src_index: MemoryIndex, _src_heap: Heap, _dst_index: MemoryIndex, _dst_heap: Heap, _dst: Value, _src: Value, _len: Value ) -> WasmResult<()>

Translate a memory.copy WebAssembly instruction. Read more
source§

fn translate_memory_fill( &mut self, _pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap, _dst: Value, _val: Value, _len: Value ) -> WasmResult<()>

Translate a memory.fill WebAssembly instruction. Read more
source§

fn translate_memory_init( &mut self, _pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap, _seg_index: u32, _dst: Value, _src: Value, _len: Value ) -> WasmResult<()>

Translate a memory.init WebAssembly instruction. Read more
source§

fn translate_data_drop( &mut self, _pos: FuncCursor<'_>, _seg_index: u32 ) -> WasmResult<()>

Translate a data.drop WebAssembly instruction.
source§

fn translate_table_size( &mut self, pos: FuncCursor<'_>, _index: TableIndex, _table: Table ) -> WasmResult<Value>

Translate a table.size WebAssembly instruction.
source§

fn translate_table_grow( &mut self, pos: FuncCursor<'_>, _table_index: TableIndex, _table: Table, _delta: Value, _init_value: Value ) -> WasmResult<Value>

Translate a table.grow WebAssembly instruction.
source§

fn translate_table_get( &mut self, builder: &mut FunctionBuilder<'_>, _table_index: TableIndex, _table: Table, _index: Value ) -> WasmResult<Value>

Translate a table.get WebAssembly instruction.
source§

fn translate_table_set( &mut self, _builder: &mut FunctionBuilder<'_>, _table_index: TableIndex, _table: Table, _value: Value, _index: Value ) -> WasmResult<()>

Translate a table.set WebAssembly instruction.
source§

fn translate_table_copy( &mut self, _pos: FuncCursor<'_>, _dst_index: TableIndex, _dst_table: Table, _src_index: TableIndex, _src_table: Table, _dst: Value, _src: Value, _len: Value ) -> WasmResult<()>

Translate a table.copy WebAssembly instruction.
source§

fn translate_table_fill( &mut self, _pos: FuncCursor<'_>, _table_index: TableIndex, _dst: Value, _val: Value, _len: Value ) -> WasmResult<()>

Translate a table.fill WebAssembly instruction.
source§

fn translate_table_init( &mut self, _pos: FuncCursor<'_>, _seg_index: u32, _table_index: TableIndex, _table: Table, _dst: Value, _src: Value, _len: Value ) -> WasmResult<()>

Translate a table.init WebAssembly instruction.
source§

fn translate_elem_drop( &mut self, _pos: FuncCursor<'_>, _seg_index: u32 ) -> WasmResult<()>

Translate a elem.drop WebAssembly instruction.
source§

fn translate_ref_func( &mut self, pos: FuncCursor<'_>, _func_index: FuncIndex ) -> WasmResult<Value>

Translate a ref.func WebAssembly instruction.
source§

fn translate_custom_global_get( &mut self, pos: FuncCursor<'_>, _global_index: GlobalIndex ) -> WasmResult<Value>

Translate a global.get WebAssembly instruction at pos for a global that is custom.
source§

fn translate_custom_global_set( &mut self, _pos: FuncCursor<'_>, _global_index: GlobalIndex, _val: Value ) -> WasmResult<()>

Translate a global.set WebAssembly instruction at pos for a global that is custom.
source§

fn translate_atomic_wait( &mut self, pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap, _addr: Value, _expected: Value, _timeout: Value ) -> WasmResult<Value>

Translate an i32.atomic.wait or i64.atomic.wait WebAssembly instruction. The index provided identifies the linear memory containing the value to wait on, and heap is the heap reference returned by make_heap for the same index. Whether the waited-on value is 32- or 64-bit can be determined by examining the type of expected, which must be only I32 or I64. Read more
source§

fn translate_atomic_notify( &mut self, pos: FuncCursor<'_>, _index: MemoryIndex, _heap: Heap, _addr: Value, _count: Value ) -> WasmResult<Value>

Translate an atomic.notify WebAssembly instruction. The index provided identifies the linear memory containing the value to wait on, and heap is the heap reference returned by make_heap for the same index. Read more
source§

fn is_wasm_parameter(&self, signature: &Signature, index: usize) -> bool

Is the given parameter of the given function a wasm-level parameter, as opposed to a hidden parameter added for use by the implementation?
source§

fn is_wasm_return(&self, signature: &Signature, index: usize) -> bool

Is the given return of the given function a wasm-level parameter, as opposed to a hidden parameter added for use by the implementation?
source§

fn after_locals(&mut self, num_locals_defined: usize)

Called after the locals for a function have been parsed, and the number of variables defined by this function is provided.
source§

fn translate_return_call( &mut self, builder: &mut FunctionBuilder<'_>, _callee_index: FuncIndex, callee: FuncRef, call_args: &[Value] ) -> WasmResult<()>

Translate a return_call WebAssembly instruction at the builder’s current position. Read more
source§

fn translate_ref_null( &mut self, pos: FuncCursor<'_>, ty: WasmHeapType ) -> WasmResult<Value>

Translate a ref.null T WebAssembly instruction. Read more
source§

fn translate_ref_is_null( &mut self, pos: FuncCursor<'_>, value: Value ) -> WasmResult<Value>

Translate a ref.is_null WebAssembly instruction. Read more
source§

fn translate_loop_header( &mut self, _builder: &mut FunctionBuilder<'_> ) -> WasmResult<()>

Emit code at the beginning of every wasm loop. Read more
source§

fn before_unconditionally_trapping_memory_access( &mut self, _builder: &mut FunctionBuilder<'_> ) -> WasmResult<()>

Optional callback for the FuncEnvironment performing this translation to maintain, prepare, or finalize custom, internal state when we statically determine that a Wasm memory access will unconditionally trap, rendering the rest of the block unreachable. Called just before the unconditional trap is emitted.
source§

fn before_translate_function( &mut self, _builder: &mut FunctionBuilder<'_>, _state: &FuncTranslationState ) -> WasmResult<()>

Optional callback for the FunctionEnvironment performing this translation to perform work before the function body is translated.
source§

fn relaxed_simd_deterministic(&self) -> bool

Whether or not to force relaxed simd instructions to have deterministic lowerings meaning they will produce the same results across all hosts, regardless of the cost to performance.
source§

fn has_native_fma(&self) -> bool

Whether or not the target being translated for has a native fma instruction. If it does not then when relaxed simd isn’t deterministic the translation of the f32x4.relaxed_fma instruction, for example, will do a multiplication and then an add instead of the fused version.
source§

fn is_x86(&self) -> bool

Returns whether this is an x86 target, which may alter lowerings of relaxed simd instructions.
source§

fn use_x86_blendv_for_relaxed_laneselect(&self, ty: Type) -> bool

Returns whether the CLIF x86_blendv instruction should be used for the relaxed simd *.relaxed_laneselect instruction for the specified type.
source§

fn use_x86_pshufb_for_relaxed_swizzle(&self) -> bool

Returns whether the CLIF x86_pshufb instruction should be used for the i8x16.relaxed_swizzle instruction.
source§

fn use_x86_pmulhrsw_for_relaxed_q15mul(&self) -> bool

Returns whether the CLIF x86_pmulhrsw instruction should be used for the i8x16.relaxed_q15mulr_s instruction.
source§

fn use_x86_pmaddubsw_for_dot(&self) -> bool

Returns whether the CLIF x86_pmaddubsw instruction should be used for the relaxed-simd dot-product instructions instruction.
source§

fn handle_before_return( &mut self, _retvals: &[Value], _builder: &mut FunctionBuilder<'_> )

Inserts code before a function return.
source§

fn before_load( &mut self, _builder: &mut FunctionBuilder<'_>, _val_size: u8, _addr: Value, _offset: u64 )

Inserts code before a load.
source§

fn before_store( &mut self, _builder: &mut FunctionBuilder<'_>, _val_size: u8, _addr: Value, _offset: u64 )

Inserts code before a store.
source§

fn update_global( &mut self, _builder: &mut FunctionBuilder<'_>, _global_index: u32, _value: Value )

Inserts code before updating a global.
source§

fn before_memory_grow( &mut self, _builder: &mut FunctionBuilder<'_>, _num_bytes: Value, _mem_index: MemoryIndex )

Inserts code before memory.grow.
source§

impl<'dummy_environment> TargetEnvironment for DummyFuncEnvironment<'dummy_environment>

source§

fn target_config(&self) -> TargetFrontendConfig

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

fn heap_access_spectre_mitigation(&self) -> bool

Whether to enable Spectre mitigations for heap accesses.
source§

fn proof_carrying_code(&self) -> bool

Whether to add proof-carrying-code facts to verify memory accesses.
source§

fn pointer_type(&self) -> Type

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

fn pointer_bytes(&self) -> u8

Get the size of a native pointer, in bytes.
source§

fn reference_type(&self, ty: WasmHeapType) -> Type

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

impl<'dummy_environment> TypeConvert for DummyFuncEnvironment<'dummy_environment>

source§

fn lookup_heap_type(&self, _index: UnpackedIndex) -> WasmHeapType

Converts the specified type index from a heap type into a canonicalized heap type.
source§

fn convert_global_type(&self, ty: &GlobalType) -> Global

Converts a wasmparser table type into a wasmtime type
source§

fn convert_table_type(&self, ty: &TableType) -> Table

Converts a wasmparser table type into a wasmtime type
source§

fn convert_func_type(&self, ty: &FuncType) -> WasmFuncType

Converts a wasmparser function type to a wasmtime type
source§

fn convert_valtype(&self, ty: ValType) -> WasmType

Converts a wasmparser value type to a wasmtime type
source§

fn convert_ref_type(&self, ty: RefType) -> WasmRefType

Converts a wasmparser reference type to a wasmtime type
source§

fn convert_heap_type(&self, ty: HeapType) -> WasmHeapType

Converts a wasmparser heap type to a wasmtime type

Auto Trait Implementations§

§

impl<'dummy_environment> Freeze for DummyFuncEnvironment<'dummy_environment>

§

impl<'dummy_environment> RefUnwindSafe for DummyFuncEnvironment<'dummy_environment>

§

impl<'dummy_environment> Send for DummyFuncEnvironment<'dummy_environment>

§

impl<'dummy_environment> Sync for DummyFuncEnvironment<'dummy_environment>

§

impl<'dummy_environment> Unpin for DummyFuncEnvironment<'dummy_environment>

§

impl<'dummy_environment> UnwindSafe for DummyFuncEnvironment<'dummy_environment>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.