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>

source

pub fn new(args: CreateSpecificPlanArgs<'_, VM>) -> Self

source

pub fn prepare(&mut self, tls: VMWorkerThread)

Prepare Gen. This should be called by a single thread in GC prepare work.

source

pub fn release(&mut self, tls: VMWorkerThread)

Release Gen. This should be called by a single thread in GC release work.

source

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.

source

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.

source

pub fn force_full_heap_collection(&self)

source

pub fn last_collection_full_heap(&self) -> bool

source

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.

source

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.

source

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.

source

pub fn is_current_gc_nursery(&self) -> bool

Is the current GC a nursery GC?

source

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.

source

pub fn set_next_gc_full_heap(&self, next_gc_full_heap: bool)

Set next_gc_full_heap to the given value.

source

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.

source

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>

§

type VM = VM

source§

fn for_each_space(&self, __func: &mut dyn FnMut(&dyn Space<VM>))

Visit each space field immutably. Read more
source§

fn for_each_space_mut(&mut self, __func: &mut dyn FnMut(&mut dyn Space<VM>))

Visit each space field mutably. Read more
source§

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

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)

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

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 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: 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>

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)

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)

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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.