Trait mmtk::vm::slot::MemorySlice
source · pub trait MemorySlice: Send + Debug + PartialEq + Eq + Clone + Hash {
type SlotType: Slot;
type SlotIterator: Iterator<Item = Self::SlotType>;
// Required methods
fn iter_slots(&self) -> Self::SlotIterator;
fn object(&self) -> Option<ObjectReference>;
fn start(&self) -> Address;
fn bytes(&self) -> usize;
fn copy(src: &Self, tgt: &Self);
}
Expand description
A abstract memory slice represents a piece of heap memory which may contains many slots.
Required Associated Types§
sourcetype SlotIterator: Iterator<Item = Self::SlotType>
type SlotIterator: Iterator<Item = Self::SlotType>
The associate type to define how to iterate slots in a memory slice.
Required Methods§
sourcefn iter_slots(&self) -> Self::SlotIterator
fn iter_slots(&self) -> Self::SlotIterator
Iterate object slots within the slice. If there are non-reference values in the slice, the iterator should skip them.
sourcefn object(&self) -> Option<ObjectReference>
fn object(&self) -> Option<ObjectReference>
The object which this slice belongs to. If we know the object for the slice, we will check the object state (e.g. mature or not), rather than the slice address. Normally checking the object and checking the slice does not make a difference, as the slice is part of the object (in terms of memory range). However, if a slice is in a different location from the object, the object state and the slice can be hugely different, and providing a proper implementation of this method for the owner object is important.