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)
| 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. |