Struct mmtk::plan::generational::global::CommonGenPlan
source · pub struct CommonGenPlan<VM: VMBinding> {
pub nursery: CopySpace<VM>,
pub common: CommonPlan<VM>,
pub gc_full_heap: AtomicBool,
pub next_gc_full_heap: AtomicBool,
pub full_heap_gc_count: Arc<Mutex<EventCounter>>,
}
Expand description
Common implementation for generational plans. Each generational plan should include this type, and forward calls to it where possible.
Fields§
§nursery: CopySpace<VM>
The nursery space.
common: CommonPlan<VM>
The common plan.
gc_full_heap: AtomicBool
Is this GC full heap?
next_gc_full_heap: AtomicBool
Is next GC full heap?
full_heap_gc_count: Arc<Mutex<EventCounter>>
Implementations§
source§impl<VM: VMBinding> CommonGenPlan<VM>
impl<VM: VMBinding> CommonGenPlan<VM>
pub fn new(args: CreateSpecificPlanArgs<'_, VM>) -> Self
sourcepub fn prepare(&mut self, tls: VMWorkerThread)
pub fn prepare(&mut self, tls: VMWorkerThread)
Prepare Gen. This should be called by a single thread in GC prepare work.
sourcepub fn release(&mut self, tls: VMWorkerThread)
pub fn release(&mut self, tls: VMWorkerThread)
Release Gen. This should be called by a single thread in GC release work.
sourcefn virtual_memory_exhausted(plan: &dyn GenerationalPlan<VM = VM>) -> bool
fn virtual_memory_exhausted(plan: &dyn GenerationalPlan<VM = VM>) -> bool
Independent of how many pages remain in the page budget (a function of heap size), we must ensure we never exhaust virtual memory. Therefore we must never let the nursery grow to the extent that it can’t be copied into the mature space.
Returns true
if the nursery has grown to the extent that it may not be able to be copied
into the mature space.
sourcepub fn collection_required<P: Plan<VM = VM>>(
&self,
plan: &P,
space_full: bool,
space: Option<SpaceStats<'_, VM>>
) -> bool
pub fn collection_required<P: Plan<VM = VM>>( &self, plan: &P, space_full: bool, space: Option<SpaceStats<'_, VM>> ) -> bool
Check if we need a GC based on the nursery space usage. This method may mark the following GC as a full heap GC.
pub fn force_full_heap_collection(&self)
pub fn last_collection_full_heap(&self) -> bool
sourcepub fn requires_full_heap_collection<P: Plan<VM = VM>>(&self, plan: &P) -> bool
pub fn requires_full_heap_collection<P: Plan<VM = VM>>(&self, plan: &P) -> bool
Check if we should do a full heap GC. It returns true if we should have a full heap GC. It also sets gc_full_heap based on the result.
sourcepub fn trace_object_full_heap<Q: ObjectQueue>(
&self,
queue: &mut Q,
object: ObjectReference,
worker: &mut GCWorker<VM>
) -> ObjectReference
pub fn trace_object_full_heap<Q: ObjectQueue>( &self, queue: &mut Q, object: ObjectReference, worker: &mut GCWorker<VM> ) -> ObjectReference
Trace objects for spaces in generational and common plans for a full heap GC.
sourcepub fn trace_object_nursery<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
worker: &mut GCWorker<VM>
) -> ObjectReference
pub fn trace_object_nursery<Q: ObjectQueue, const KIND: u8>( &self, queue: &mut Q, object: ObjectReference, worker: &mut GCWorker<VM> ) -> ObjectReference
Trace objects for spaces in generational and common plans for a nursery GC.
sourcepub fn is_current_gc_nursery(&self) -> bool
pub fn is_current_gc_nursery(&self) -> bool
Is the current GC a nursery GC?
sourcepub fn should_next_gc_be_full_heap(plan: &dyn Plan<VM = VM>) -> bool
pub fn should_next_gc_be_full_heap(plan: &dyn Plan<VM = VM>) -> bool
Check a plan to see if the next GC should be a full heap GC.
Note that this function should be called after all spaces have been released. This is
required as we may get incorrect values since this function uses
get_available_pages
whose value depends on which spaces have been released.
sourcepub fn set_next_gc_full_heap(&self, next_gc_full_heap: bool)
pub fn set_next_gc_full_heap(&self, next_gc_full_heap: bool)
Set next_gc_full_heap to the given value.
sourcepub fn get_collection_reserved_pages(&self) -> usize
pub fn get_collection_reserved_pages(&self) -> usize
Get pages reserved for the collection by a generational plan. A generational plan should add their own reservation with the value returned by this method.
sourcepub fn get_used_pages(&self) -> usize
pub fn get_used_pages(&self) -> usize
Get pages used by a generational plan. A generational plan should add their own used pages with the value returned by this method.
Trait Implementations§
source§impl<VM: VMBinding> HasSpaces for CommonGenPlan<VM>
impl<VM: VMBinding> HasSpaces for CommonGenPlan<VM>
source§impl<VM: VMBinding> PlanTraceObject<VM> for CommonGenPlan<VM>
impl<VM: VMBinding> PlanTraceObject<VM> for CommonGenPlan<VM>
source§fn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
__mmtk_queue: &mut Q,
__mmtk_objref: ObjectReference,
__mmtk_worker: &mut GCWorker<VM>
) -> ObjectReference
fn trace_object<Q: ObjectQueue, const KIND: u8>( &self, __mmtk_queue: &mut Q, __mmtk_objref: ObjectReference, __mmtk_worker: &mut GCWorker<VM> ) -> ObjectReference
source§fn post_scan_object(&self, __mmtk_objref: ObjectReference)
fn post_scan_object(&self, __mmtk_objref: ObjectReference)
VM::VMScanning::scan_object()
, and this function
will be called after the VM::VMScanning::scan_object()
as a hook to invoke possible policy post scan method.
If a plan does not have any policy that needs post scan, this method can be implemented as empty.
If a plan has a policy that has some policy specific behaviors for scanning (e.g. mark lines in Immix),
this method should also invoke those policy specific methods for objects in that space.source§fn may_move_objects<const KIND: u8>() -> bool
fn may_move_objects<const KIND: u8>() -> bool
Auto Trait Implementations§
impl<VM> !RefUnwindSafe for CommonGenPlan<VM>
impl<VM> Send for CommonGenPlan<VM>
impl<VM> Sync for CommonGenPlan<VM>
impl<VM> Unpin for CommonGenPlan<VM>where
VM: Unpin,
impl<VM> !UnwindSafe for CommonGenPlan<VM>
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