pub struct ShapeArray { /* private fields */ }Expand description
Unified array with C-ABI-stable layout for JIT and VM.
Elements are ValueWord values stored in a contiguous heap buffer.
Clone/Drop correctly manage heap-tagged ValueWord reference counts.
Implementations§
Source§impl ShapeArray
Byte offsets for JIT inline access.
impl ShapeArray
Byte offsets for JIT inline access.
Sourcepub const OFFSET_DATA: usize = 0
pub const OFFSET_DATA: usize = 0
Byte offset of the data pointer field.
Sourcepub const OFFSET_LEN: usize = 8
pub const OFFSET_LEN: usize = 8
Byte offset of the len field.
Sourcepub const OFFSET_CAP: usize = 16
pub const OFFSET_CAP: usize = 16
Byte offset of the cap field.
Source§impl ShapeArray
impl ShapeArray
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create an array with pre-allocated capacity.
Sourcepub fn from_iter(iter: impl IntoIterator<Item = ValueWord>) -> Self
pub fn from_iter(iter: impl IntoIterator<Item = ValueWord>) -> Self
Create an array from an iterator of ValueWord values.
Sourcepub fn from_slice(elements: &[ValueWord]) -> Self
pub fn from_slice(elements: &[ValueWord]) -> Self
Create an array by cloning from a slice of ValueWord.
Sourcepub unsafe fn from_raw_u64_slice(elements: &[u64]) -> Self
pub unsafe fn from_raw_u64_slice(elements: &[u64]) -> Self
Create from a raw u64 slice (for JIT interop).
§Safety
The caller must ensure that each u64 is a valid ValueWord bit pattern. For heap-tagged values, the caller must ensure the Arc refcount has been incremented appropriately (or that this array takes ownership).
Sourcepub fn as_mut_slice(&mut self) -> &mut [ValueWord]
pub fn as_mut_slice(&mut self) -> &mut [ValueWord]
View elements as a mutable slice.
Sourcepub fn as_raw_u64_slice(&self) -> &[u64]
pub fn as_raw_u64_slice(&self) -> &[u64]
View raw buffer as u64 slice (for JIT interop).
Sourcepub fn as_ptr(&self) -> *const ValueWord
pub fn as_ptr(&self) -> *const ValueWord
Raw pointer to the data buffer (for JIT inline access).
Sourcepub fn as_mut_ptr(&mut self) -> *mut ValueWord
pub fn as_mut_ptr(&mut self) -> *mut ValueWord
Raw mutable pointer to the data buffer (for JIT inline access).