mmtk::util::heap::layout::mmapper::csm

Trait MapStateStorage

source
trait MapStateStorage {
    // Required methods
    fn log_mappable_bytes(&self) -> u8;
    fn get_state(&self, chunk: Address) -> MapState;
    fn bulk_set_state(&self, range: ChunkRange, state: MapState);
    fn bulk_transition_state<F>(
        &self,
        range: ChunkRange,
        update_fn: F,
    ) -> Result<()>
       where F: FnMut(ChunkRange, MapState) -> Result<Option<MapState>>;
}
Expand description

The back-end storage of ChunkStateMmapper. It is responsible for holding the states of each chunk (eagerly or lazily) and transitioning the states in bulk.

Required Methods§

source

fn log_mappable_bytes(&self) -> u8

The logarithm of the address space size this MapStateStorage can handle.

source

fn get_state(&self, chunk: Address) -> MapState

Return the state of a given chunk (must be aligned).

Note that all chunks are logically MapState::Unmapped before the states are stored. They include chunks outside the mappable address range.

source

fn bulk_set_state(&self, range: ChunkRange, state: MapState)

Set all chunks within range to state.

source

fn bulk_transition_state<F>( &self, range: ChunkRange, update_fn: F, ) -> Result<()>

Visit the chunk states within range and allow the update_fn callback to inspect and change the states.

It visits chunks from low to high addresses, and calls update_fn(group_range, group_state) for each contiguous chunk range group_range that have the same state group_state. update_fn can take actions accordingly and return one of the three values:

  • Err(err): Stop visiting and return Err(err) from bulk_transition_state immediately.
  • Ok(None): Continue visiting the next chunk range without changing chunk states.
  • Ok(Some(new_state)): Set the state of all chunks within group_range to new_state.

Return Ok(()) if finished visiting all chunks normally.

Object Safety§

This trait is not object safe.

Implementors§