MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / reference_type

Function reference_type

crates/cranelift/src/lib.rs:213–222  ·  view source on GitHub ↗

Returns the reference type to use for the provided wasm type.

(wasm_ht: WasmHeapType, pointer_type: ir::Type)

Source from the content-addressed store, hash-verified

211
212/// Returns the reference type to use for the provided wasm type.
213fn reference_type(wasm_ht: WasmHeapType, pointer_type: ir::Type) -> ir::Type {
214 match wasm_ht.top() {
215 WasmHeapTopType::Func => pointer_type,
216 WasmHeapTopType::Any | WasmHeapTopType::Extern | WasmHeapTopType::Exn => ir::types::I32,
217 WasmHeapTopType::Cont => {
218 // VMContObj is 2 * pointer_size (pointer + usize revision)
219 ir::Type::int((2 * pointer_type.bits()).try_into().unwrap()).unwrap()
220 }
221 }
222}
223
224// List of namespaces which are processed in `mach_reloc_to_reloc` below.
225

Callers 2

value_typeFunction · 0.85
reference_typeMethod · 0.85

Calls 4

topMethod · 0.45
unwrapMethod · 0.45
try_intoMethod · 0.45
bitsMethod · 0.45

Tested by

no test coverage detected