pub trait TargetEnvironment: TypeConvert {
// Required methods
fn target_config(&self) -> TargetFrontendConfig;
fn heap_access_spectre_mitigation(&self) -> bool;
fn proof_carrying_code(&self) -> bool;
fn reference_type(&self, ty: WasmHeapType) -> (Type, bool);
// Provided methods
fn pointer_type(&self) -> Type { ... }
fn pointer_bytes(&self) -> u8 { ... }
}
Expand description
Environment affecting the translation of a WebAssembly.
Required Methods§
Sourcefn target_config(&self) -> TargetFrontendConfig
fn target_config(&self) -> TargetFrontendConfig
Get the information needed to produce Cranelift IR for the given target.
Sourcefn heap_access_spectre_mitigation(&self) -> bool
fn heap_access_spectre_mitigation(&self) -> bool
Whether to enable Spectre mitigations for heap accesses.
Sourcefn proof_carrying_code(&self) -> bool
fn proof_carrying_code(&self) -> bool
Whether to add proof-carrying-code facts to verify memory accesses.
Sourcefn reference_type(&self, ty: WasmHeapType) -> (Type, bool)
fn reference_type(&self, ty: WasmHeapType) -> (Type, bool)
Get the Cranelift reference type to use for the given Wasm reference type.
Returns a pair of the CLIF reference type to use and a boolean that describes whether the value should be included in GC stack maps or not.
Provided Methods§
Sourcefn pointer_type(&self) -> Type
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.
Sourcefn pointer_bytes(&self) -> u8
fn pointer_bytes(&self) -> u8
Get the size of a native pointer, in bytes.