#[repr(C)]pub struct UnifiedValue<T> {
pub kind: u16,
pub flags: u8,
pub _reserved: u8,
pub refcount: AtomicU32,
pub data: T,
}Expand description
Generic unified heap value with the standard header format.
Layout: [kind: u16][flags: u8][_reserved: u8][refcount: AtomicU32][data: T]
Data starts at offset 8, same as JitAlloc.
The kind: u16 at offset 0 is layout-compatible with JitAlloc<T> so
read_heap_kind works on both shapes uniformly.
Fields§
§kind: u16§flags: u8§_reserved: u8§refcount: AtomicU32§data: TImplementations§
Source§impl<T> UnifiedValue<T>
impl<T> UnifiedValue<T>
pub fn new(kind: u16, data: T) -> Self
Sourcepub fn heap_box(self) -> u64
pub fn heap_box(self) -> u64
Allocate this value on the heap and return the raw Box::into_raw
pointer cast to u64. Per §2.7.5 the JIT-FFI boundary carries this
u64 directly alongside a parallel NativeKind companion supplied
from the call signature.
Sourcepub unsafe fn from_heap_bits(bits: u64) -> &'static Self
pub unsafe fn from_heap_bits(bits: u64) -> &'static Self
§Safety
bits must be a Box::into_raw-returned pointer to a live
UnifiedValue<T> allocation (or one produced by heap_box on the same
T). Callers also vouch that the parallel NativeKind they have for
this slot is consistent with T per the §2.7.5 stamp.
Sourcepub unsafe fn from_heap_bits_mut(bits: u64) -> &'static mut Self
pub unsafe fn from_heap_bits_mut(bits: u64) -> &'static mut Self
§Safety
Same as from_heap_bits, plus exclusive access must be guaranteed.
Auto Trait Implementations§
impl<T> !Freeze for UnifiedValue<T>
impl<T> RefUnwindSafe for UnifiedValue<T>where
T: RefUnwindSafe,
impl<T> Send for UnifiedValue<T>where
T: Send,
impl<T> Sync for UnifiedValue<T>where
T: Sync,
impl<T> Unpin for UnifiedValue<T>where
T: Unpin,
impl<T> UnsafeUnpin for UnifiedValue<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for UnifiedValue<T>where
T: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more