#[repr(u8)]pub(super) enum MapState {
Unmapped = 0,
Quarantined = 1,
Mapped = 2,
Protected = 3,
}
Expand description
The mmap state of a mmap chunk.
Variants§
Unmapped = 0
The chunk is unmapped and not managed by MMTk.
Quarantined = 1
The chunk is reserved for future use. MMTk reserved the address range but hasn’t used it yet. We have reserved the addresss range with mmap_noreserve with PROT_NONE.
Mapped = 2
The chunk is mapped by MMTk and is in use.
Protected = 3
The chunk is mapped and is also protected by MMTk.
Implementations§
source§impl MapState
impl MapState
sourcepub(super) fn transition_to_mapped(
state: &Atomic<MapState>,
mmap_start: Address,
strategy: MmapStrategy,
anno: &MmapAnnotation<'_>
) -> Result<()>
pub(super) fn transition_to_mapped( state: &Atomic<MapState>, mmap_start: Address, strategy: MmapStrategy, anno: &MmapAnnotation<'_> ) -> Result<()>
Check the current MapState of the chunk, and transition the chunk to MapState::Mapped. The caller should hold a lock before invoking this method.
sourcepub(super) fn transition_to_quarantined(
state: &Atomic<MapState>,
mmap_start: Address,
strategy: MmapStrategy,
anno: &MmapAnnotation<'_>
) -> Result<()>
pub(super) fn transition_to_quarantined( state: &Atomic<MapState>, mmap_start: Address, strategy: MmapStrategy, anno: &MmapAnnotation<'_> ) -> Result<()>
Check the current MapState of the chunk, and transition the chunk to MapState::Quarantined. The caller should hold a lock before invoking this method.
sourcepub(super) fn bulk_transition_to_quarantined(
state_slices: &[&[Atomic<MapState>]],
mmap_start: Address,
strategy: MmapStrategy,
anno: &MmapAnnotation<'_>
) -> Result<()>
pub(super) fn bulk_transition_to_quarantined( state_slices: &[&[Atomic<MapState>]], mmap_start: Address, strategy: MmapStrategy, anno: &MmapAnnotation<'_> ) -> Result<()>
Equivalent to calling transition_to_quarantined
on each element of states
, but faster.
The caller should hold a lock before invoking this method.
The memory region to transition starts from mmap_start
. The size is the chunk size
multiplied by the total number of Atomic<MapState>
in the nested slice of slices.
This function is introduced to speed up initialization of MMTk. MMTk tries to quarantine
very large amount of memory during start-up. If we quarantine one chunk at a time, it will
require thousands of mmap
calls to cover gigabytes of quarantined memory, introducing a
noticeable delay.
Arguments:
state_slices
: A slice of slices. Each inner slice is a part of aSlab
.mmap_start
: The start of the region to transition.strategy
: The mmap strategy.anno
: Human-readable annotation to apply to newly mapped memory ranges.
Trait Implementations§
source§impl PartialEq for MapState
impl PartialEq for MapState
impl Copy for MapState
impl Eq for MapState
impl NoUninit for MapState
impl StructuralPartialEq for MapState
Auto Trait Implementations§
impl RefUnwindSafe for MapState
impl Send for MapState
impl Sync for MapState
impl Unpin for MapState
impl UnwindSafe for MapState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more