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§

source

type SlotType: Slot

The associate type to define how to access slots from a memory slice.

source

type SlotIterator: Iterator<Item = Self::SlotType>

The associate type to define how to iterate slots in a memory slice.

Required Methods§

source

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.

source

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.

source

fn start(&self) -> Address

Start address of the memory slice

source

fn bytes(&self) -> usize

Size of the memory slice

source

fn copy(src: &Self, tgt: &Self)

Memory copy support

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MemorySlice for Range<Address>

Implementors§