#[repr(u32)]pub enum VMGcKind {
ExternRef = 1_073_741_824,
ExternOfAnyRef = 1_610_612_736,
AnyRef = 2_147_483_648,
AnyOfExternRef = 2_415_919_104,
EqRef = 2_684_354_560,
ArrayRef = 2_751_463_424,
StructRef = 2_818_572_288,
}Expand description
The kind of an object in a GC heap.
Note that this type is accessed from Wasm JIT code.
VMGcKind is a bitset where to test if a is a subtype of an
“abstract-ish” type b, we can simply use a single bitwise-and operation:
a <: b iff a & b == bFor example, because VMGcKind::AnyRef has the high bit set, every kind
representing some subtype of anyref also has its high bit set.
We say “abstract-ish” type because in addition to the abstract heap types
(other than i31) we also have variants for externrefs that have been
converted into an anyref via extern.convert_any and externrefs that
have been converted into an anyref via any.convert_extern. Note that in
the latter case, because any.convert_extern $foo produces a value that is
not an instance of eqref, VMGcKind::AnyOfExternRef & VMGcKind::EqRef != VMGcKind::EqRef.
Furthermore, this type only uses the highest 6 bits of its u32
representation, allowing the lower 26 bytes to be bitpacked with other stuff
as users see fit.
Variants§
ExternRef = 1_073_741_824
ExternOfAnyRef = 1_610_612_736
AnyRef = 2_147_483_648
AnyOfExternRef = 2_415_919_104
EqRef = 2_684_354_560
ArrayRef = 2_751_463_424
StructRef = 2_818_572_288
Implementations§
Source§impl VMGcKind
impl VMGcKind
Sourcepub const MASK: u32 = 4_227_858_432u32
pub const MASK: u32 = 4_227_858_432u32
Mask this value with a u32 to get just the bits that VMGcKind uses.
Sourcepub const UNUSED_MASK: u32 = 67_108_863u32
pub const UNUSED_MASK: u32 = 67_108_863u32
Mask this value with a u32 that potentially contains a VMGcKind to
get the bits that VMGcKind doesn’t use.
Sourcepub fn from_high_bits_of_u32(val: u32) -> VMGcKind
pub fn from_high_bits_of_u32(val: u32) -> VMGcKind
Convert the given value into a VMGcKind by masking off the unused
bottom bits.
Trait Implementations§
impl Copy for VMGcKind
impl Eq for VMGcKind
impl StructuralPartialEq for VMGcKind
Auto Trait Implementations§
impl Freeze for VMGcKind
impl RefUnwindSafe for VMGcKind
impl Send for VMGcKind
impl Sync for VMGcKind
impl Unpin for VMGcKind
impl UnwindSafe for VMGcKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.