Trait mmtk::vm::edge_shape::MemorySlice
source · pub trait MemorySlice: Send + Debug + PartialEq + Eq + Clone + Hash {
type Edge: Edge;
type EdgeIterator: Iterator<Item = Self::Edge>;
// Required methods
fn iter_edges(&self) -> Self::EdgeIterator;
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.
Required Associated Types§
sourcetype EdgeIterator: Iterator<Item = Self::Edge>
type EdgeIterator: Iterator<Item = Self::Edge>
The associate type to define how to iterate edges in a memory slice.
Required Methods§
sourcefn iter_edges(&self) -> Self::EdgeIterator
fn iter_edges(&self) -> Self::EdgeIterator
Iterate object edges 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.