pub struct GenImmix<VM: VMBinding> {
pub gen: CommonGenPlan<VM>,
pub immix_space: ImmixSpace<VM>,
pub last_gc_was_defrag: AtomicBool,
pub last_gc_was_full_heap: AtomicBool,
}
Expand description
Generational immix. This implements the functionality of a two-generation copying collector where the higher generation is an immix space. See the PLDI’08 paper by Blackburn and McKinley for a description of the algorithm: http://doi.acm.org/10.1145/1375581.1375586.
Fields§
§gen: CommonGenPlan<VM>
Generational plan, which includes a nursery space and operations related with nursery.
immix_space: ImmixSpace<VM>
An immix space as the mature space.
last_gc_was_defrag: AtomicBool
Whether the last GC was a defrag GC for the immix space.
last_gc_was_full_heap: AtomicBool
Whether the last GC was a full heap GC
Implementations§
source§impl<VM: VMBinding> GenImmix<VM>
impl<VM: VMBinding> GenImmix<VM>
pub fn new(args: CreateGeneralPlanArgs<'_, VM>) -> Self
fn requires_full_heap_collection(&self) -> bool
Trait Implementations§
source§impl<VM: VMBinding> GenerationalPlan for GenImmix<VM>
impl<VM: VMBinding> GenerationalPlan for GenImmix<VM>
source§fn is_current_gc_nursery(&self) -> bool
fn is_current_gc_nursery(&self) -> bool
Is the current GC a nursery GC? If a GC is not a nursery GC, it will be a full heap GC.
This should only be called during GC.
source§fn is_object_in_nursery(&self, object: ObjectReference) -> bool
fn is_object_in_nursery(&self, object: ObjectReference) -> bool
Is the object in the nursery?
source§fn is_address_in_nursery(&self, addr: Address) -> bool
fn is_address_in_nursery(&self, addr: Address) -> bool
Is the address in the nursery? As we only know addresses rather than object references, the
implementation cannot access per-object metadata. If the plan does not have knowledge whether
the address is in nursery or not (e.g. mature/nursery objects share the same space and are
only differentiated by object metadata), the implementation should return
false
as a more
conservative result.source§fn get_mature_physical_pages_available(&self) -> usize
fn get_mature_physical_pages_available(&self) -> usize
Return the number of pages available for allocation into the mature space.
source§fn get_mature_reserved_pages(&self) -> usize
fn get_mature_reserved_pages(&self) -> usize
Return the number of used pages in the mature space.
source§fn force_full_heap_collection(&self)
fn force_full_heap_collection(&self)
Force the next collection to be full heap.
source§fn last_collection_full_heap(&self) -> bool
fn last_collection_full_heap(&self) -> bool
Return whether last GC is a full GC.
source§impl<VM: VMBinding> GenerationalPlanExt<VM> for GenImmix<VM>
impl<VM: VMBinding> GenerationalPlanExt<VM> for GenImmix<VM>
source§fn trace_object_nursery<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
worker: &mut GCWorker<VM>
) -> ObjectReference
fn trace_object_nursery<Q: ObjectQueue, const KIND: u8>( &self, queue: &mut Q, object: ObjectReference, worker: &mut GCWorker<VM> ) -> ObjectReference
Trace an object in nursery collection. If the object is in nursery, we should call
trace_object
on the space. Otherwise, we can just return the object.source§impl<VM: VMBinding> Plan for GenImmix<VM>
impl<VM: VMBinding> Plan for GenImmix<VM>
source§fn get_available_pages(&self) -> usize
fn get_available_pages(&self) -> usize
Return the number of pages available for allocation. Assuming all future allocations goes to nursery.
source§fn constraints(&self) -> &'static PlanConstraints
fn constraints(&self) -> &'static PlanConstraints
Get the plan constraints for the plan.
This returns a non-constant value. A constant value can be found in each plan’s module if needed.
source§fn create_copy_config(&'static self) -> CopyConfig<Self::VM>
fn create_copy_config(&'static self) -> CopyConfig<Self::VM>
Create a copy config for this plan. A copying GC plan MUST override this method,
and provide a valid config.
source§fn last_collection_was_exhaustive(&self) -> bool
fn last_collection_was_exhaustive(&self) -> bool
Return whether last GC was an exhaustive attempt to collect the heap.
For example, for generational GCs, minor collection is not an exhaustive collection.
For example, for Immix, fast collection (no defragmentation) is not an exhaustive collection.
source§fn collection_required(
&self,
space_full: bool,
space: Option<SpaceStats<'_, Self::VM>>
) -> boolwhere
Self: Sized,
fn collection_required(
&self,
space_full: bool,
space: Option<SpaceStats<'_, Self::VM>>
) -> boolwhere
Self: Sized,
Ask the plan if they would trigger a GC. If MMTk is in charge of triggering GCs, this method is called
periodically during allocation. However, MMTk may delegate the GC triggering decision to the runtime,
in which case, this method may not be called. This method returns true to trigger a collection. Read more
source§fn schedule_collection(&'static self, scheduler: &GCWorkScheduler<Self::VM>)
fn schedule_collection(&'static self, scheduler: &GCWorkScheduler<Self::VM>)
Schedule work for the upcoming GC.
source§fn get_allocator_mapping(
&self
) -> &'static EnumMap<AllocationSemantics, AllocatorSelector>
fn get_allocator_mapping( &self ) -> &'static EnumMap<AllocationSemantics, AllocatorSelector>
Get the allocator mapping between
crate::AllocationSemantics
and crate::util::alloc::AllocatorSelector
.
This defines what space this plan will allocate objects into for different semantics.source§fn prepare(&mut self, tls: VMWorkerThread)
fn prepare(&mut self, tls: VMWorkerThread)
Prepare the plan before a GC. This is invoked in an initial step in the GC.
This is invoked once per GC by one worker thread.
tls
is the worker thread that executes this method.source§fn release(&mut self, tls: VMWorkerThread)
fn release(&mut self, tls: VMWorkerThread)
Release the plan after transitive closure. A plan can implement this method to call each policy’s release,
or create any work packet that should be done in release.
This is invoked once per GC by one worker thread.
tls
is the worker thread that executes this method.source§fn end_of_gc(&mut self, _tls: VMWorkerThread)
fn end_of_gc(&mut self, _tls: VMWorkerThread)
Inform the plan about the end of a GC. It is guaranteed that there is no further work for this GC.
This is invoked once per GC by one worker thread.
tls
is the worker thread that executes this method.source§fn current_gc_may_move_object(&self) -> bool
fn current_gc_may_move_object(&self) -> bool
Return whether the current GC may move any object. The VM binding can make use of this
information and choose to or not to update some data structures that record the addresses
of objects. Read more
source§fn get_collection_reserved_pages(&self) -> usize
fn get_collection_reserved_pages(&self) -> usize
Get the number of pages that are reserved for collection. By default, we return 0.
For copying plans, they need to override this and calculate required pages to complete
a copying GC.
source§fn get_used_pages(&self) -> usize
fn get_used_pages(&self) -> usize
Get the number of pages that are used.
source§fn base(&self) -> &BasePlan<VM>
fn base(&self) -> &BasePlan<VM>
Get a immutable reference to the base plan.
BasePlan
is included by all the MMTk GC plans.source§fn base_mut(&mut self) -> &mut BasePlan<Self::VM>
fn base_mut(&mut self) -> &mut BasePlan<Self::VM>
Get a mutable reference to the base plan.
BasePlan
is included by all the MMTk GC plans.source§fn common(&self) -> &CommonPlan<VM>
fn common(&self) -> &CommonPlan<VM>
Get the common plan. CommonPlan is included by most of MMTk GC plans.
source§fn generational(&self) -> Option<&dyn GenerationalPlan<VM = VM>>
fn generational(&self) -> Option<&dyn GenerationalPlan<VM = VM>>
Return a reference to
GenerationalPlan
to allow
access methods specific to generational plans if the plan is a generational plan.source§fn prepare_worker(&self, _worker: &mut GCWorker<Self::VM>)
fn prepare_worker(&self, _worker: &mut GCWorker<Self::VM>)
Prepare a worker for a GC. Each worker has its own prepare method. This hook is for plan-specific
per-worker preparation. This method is invoked once per worker by the worker thread passed as the argument.
source§fn notify_emergency_collection(&self)
fn notify_emergency_collection(&self)
Notify the plan that an emergency collection will happen. The plan should try to free as much memory as possible.
The default implementation will force a full heap collection for generational plans.
source§fn get_reserved_pages(&self) -> usize
fn get_reserved_pages(&self) -> usize
Get the number of pages that are reserved, including pages used by MMTk spaces, pages that
will be used (e.g. for copying), and live pages allocated outside MMTk spaces as reported
by the VM binding.
source§fn get_total_pages(&self) -> usize
fn get_total_pages(&self) -> usize
Get the total number of pages for the heap.
source§fn get_free_pages(&self) -> usize
fn get_free_pages(&self) -> usize
Get the number of pages that are NOT used. This is clearly different from available pages.
Free pages are unused, but some of them may have been reserved for some reason.
source§fn sanity_check_object(&self, _object: ObjectReference) -> bool
fn sanity_check_object(&self, _object: ObjectReference) -> bool
An object is firstly reached by a sanity GC. So the object is reachable
in the current GC, and all the GC work has been done for the object (such as
tracing and releasing). A plan can implement this to
use plan specific semantics to check if the object is sane.
Return true if the object is considered valid by the plan.
source§fn verify_side_metadata_sanity(&self)
fn verify_side_metadata_sanity(&self)
Call
space.verify_side_metadata_sanity
for all spaces in this plan.source§impl<VM: VMBinding> PlanTraceObject<VM> for GenImmix<VM>
impl<VM: VMBinding> PlanTraceObject<VM> for GenImmix<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
Trace objects in the plan. Generally one needs to figure out
which space an object resides in, and invokes the corresponding policy
trace object method. Read more
source§fn post_scan_object(&self, __mmtk_objref: ObjectReference)
fn post_scan_object(&self, __mmtk_objref: ObjectReference)
Post-scan objects in the plan. Each object is scanned by
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
Whether objects in this plan may move. If any of the spaces used by the plan may move objects, this should
return true.
Auto Trait Implementations§
impl<VM> !RefUnwindSafe for GenImmix<VM>
impl<VM> Send for GenImmix<VM>
impl<VM> Sync for GenImmix<VM>
impl<VM> Unpin for GenImmix<VM>where
VM: Unpin,
impl<VM> !UnwindSafe for GenImmix<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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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>
Converts
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>
Converts
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