Trait cranelift_wasm::TargetEnvironment

source ·
pub trait TargetEnvironment: TypeConvert {
    // Required methods
    fn target_config(&self) -> TargetFrontendConfig;
    fn heap_access_spectre_mitigation(&self) -> bool;
    fn proof_carrying_code(&self) -> bool;

    // Provided methods
    fn pointer_type(&self) -> Type { ... }
    fn pointer_bytes(&self) -> u8 { ... }
    fn reference_type(&self, ty: WasmHeapType) -> Type { ... }
}
Expand description

Environment affecting the translation of a WebAssembly.

Required Methods§

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.

Provided Methods§

source

fn pointer_type(&self) -> Type

Get the Cranelift integer type to use for native pointers.

This returns I64 for 64-bit architectures and I32 for 32-bit architectures.

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.

By default, this returns R64 for 64-bit architectures and R32 for 32-bit architectures. If you override this, then you should also override FuncEnvironment::{translate_ref_null, translate_ref_is_null} as well.

Implementors§

source§

impl TargetEnvironment for DummyEnvironment

source§

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