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

Method from

crates/wasmtime/src/runtime/vm/table.rs:58–68  ·  view source on GitHub ↗

Converts the given `ptr`, a valid funcref pointer, into a tagged pointer by adding in the `FUNCREF_INIT_BIT`.

(ptr: Option<NonNull<VMFuncRef>>, lazy_init: bool)

Source from the content-addressed store, hash-verified

56 /// Converts the given `ptr`, a valid funcref pointer, into a tagged pointer
57 /// by adding in the `FUNCREF_INIT_BIT`.
58 fn from(ptr: Option<NonNull<VMFuncRef>>, lazy_init: bool) -> Self {
59 let maybe_tagged = if lazy_init {
60 Some(match ptr {
61 Some(ptr) => ptr.map_addr(|a| a | FUNCREF_INIT_BIT),
62 None => NonNull::new(core::ptr::without_provenance_mut(FUNCREF_INIT_BIT)).unwrap(),
63 })
64 } else {
65 ptr
66 };
67 MaybeTaggedFuncRef(maybe_tagged.map(Into::into))
68 }
69
70 /// Converts a tagged pointer into a `TableElement`, returning `UninitFunc`
71 /// for null (not a tagged value) or `FuncRef` for otherwise tagged values.

Callers

nothing calls this directly

Calls 8

MaybeTaggedFuncRefClass · 0.85
GcRefInterface · 0.85
StaticClass · 0.85
DynamicClass · 0.85
newFunction · 0.50
FuncClass · 0.50
unwrapMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected