pub struct DualArrayStore {
pub global: ArrayStore,
pub local: ArrayStore,
}Expand description
Dual-arena array store with separate global and local backing stores.
Fields§
§global: ArrayStore§local: ArrayStoreImplementations§
Source§impl DualArrayStore
impl DualArrayStore
pub fn new() -> Self
Sourcepub fn allocated_objects(&self) -> usize
pub fn allocated_objects(&self) -> usize
Combined high-water mark of both arenas, in object slots.
See ArrayStore::allocated_objects.
Sourcepub fn allocate_at_level_zero(&mut self, len: usize) -> EntityId
pub fn allocate_at_level_zero(&mut self, len: usize) -> EntityId
Allocate len null-filled slots in local VM, stamped as if no save were outstanding.
The entity is stamped save_level = 0, global = false,
created_after_save = 0 — it claims to predate every outstanding
save. That is only true during bootstrap, before any save can have
happened. Everywhere else prefer the VM-aware helpers in
stet_ops::vm_ops (alloc_dict / alloc_array / alloc_string, or
their _in variants): an entity mis-stamped this way is invisible to
the invalidrestore check while still being released by the matching
restore.
Sourcepub fn allocate_from_at_level_zero(&mut self, items: &[PsObject]) -> EntityId
pub fn allocate_from_at_level_zero(&mut self, items: &[PsObject]) -> EntityId
Allocate and copy items into local VM, stamped as if no save were outstanding.
The entity is stamped save_level = 0, global = false,
created_after_save = 0 — it claims to predate every outstanding
save. That is only true during bootstrap, before any save can have
happened. Everywhere else prefer the VM-aware helpers in
stet_ops::vm_ops (alloc_dict / alloc_array / alloc_string, or
their _in variants): an entity mis-stamped this way is invisible to
the invalidrestore check while still being released by the matching
restore.
Sourcepub fn allocate_from_with(
&mut self,
items: &[PsObject],
save_level: u16,
global: bool,
created_after_save: u32,
) -> EntityId
pub fn allocate_from_with( &mut self, items: &[PsObject], save_level: u16, global: bool, created_after_save: u32, ) -> EntityId
Allocate and copy items with a specific save level and global flag.
Sourcepub fn allocate_with(
&mut self,
len: usize,
save_level: u16,
global: bool,
created_after_save: u32,
) -> EntityId
pub fn allocate_with( &mut self, len: usize, save_level: u16, global: bool, created_after_save: u32, ) -> EntityId
Allocate with a specific save level and global flag.
Sourcepub fn get(&self, entity: EntityId, start: u32, len: u32) -> &[PsObject]
pub fn get(&self, entity: EntityId, start: u32, len: u32) -> &[PsObject]
Get a slice of array elements.
Sourcepub fn get_mut(
&mut self,
entity: EntityId,
start: u32,
len: u32,
) -> &mut [PsObject]
pub fn get_mut( &mut self, entity: EntityId, start: u32, len: u32, ) -> &mut [PsObject]
Get a mutable slice of array elements.
Sourcepub fn get_element(&self, entity: EntityId, index: u32) -> PsObject
pub fn get_element(&self, entity: EntityId, index: u32) -> PsObject
Get a single element.
Sourcepub fn set_element(&mut self, entity: EntityId, index: u32, obj: PsObject)
pub fn set_element(&mut self, entity: EntityId, index: u32, obj: PsObject)
Set a single element.
Sourcepub fn cow_copy(&mut self, entity: EntityId) -> EntityId
pub fn cow_copy(&mut self, entity: EntityId) -> EntityId
COW copy (always local — global entities skip COW).
Sourcepub fn swap_offsets(&mut self, a: EntityId, b: EntityId)
pub fn swap_offsets(&mut self, a: EntityId, b: EntityId)
Swap offsets between two entities (used by restore, always local).
Sourcepub fn entity_meta(&self, entity: EntityId) -> &EntityMeta
pub fn entity_meta(&self, entity: EntityId) -> &EntityMeta
Get entity metadata (read-only).
Sourcepub fn entity_meta_mut(&mut self, entity: EntityId) -> &mut EntityMeta
pub fn entity_meta_mut(&mut self, entity: EntityId) -> &mut EntityMeta
Get mutable entity metadata.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Total entity count across both stores.
Sourcepub fn reset_local(&mut self)
pub fn reset_local(&mut self)
Reset local VM (for job boundary cleanup).