pub struct SemiSpace<VM: VMBinding> {
    pub hi: AtomicBool,
    pub copyspace0: CopySpace<VM>,
    pub copyspace1: CopySpace<VM>,
    pub common: CommonPlan<VM>,
}

Fields§

§hi: AtomicBool§copyspace0: CopySpace<VM>§copyspace1: CopySpace<VM>§common: CommonPlan<VM>

Implementations§

source§

impl<VM: VMBinding> SemiSpace<VM>

source

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

source

pub fn tospace(&self) -> &CopySpace<VM>

source

pub fn tospace_mut(&mut self) -> &mut CopySpace<VM>

source

pub fn fromspace(&self) -> &CopySpace<VM>

source

pub fn fromspace_mut(&mut self) -> &mut CopySpace<VM>

Trait Implementations§

source§

impl<VM: VMBinding> HasSpaces for SemiSpace<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> Plan for SemiSpace<VM>

source§

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>

Create a copy config for this plan. A copying GC plan MUST override this method, and provide a valid config.
source§

fn schedule_collection(&'static self, scheduler: &GCWorkScheduler<VM>)

Schedule work for the upcoming GC.
source§

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)

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 prepare_worker(&self, worker: &mut GCWorker<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 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 collection_required( &self, space_full: bool, _space: Option<SpaceStats<'_, Self::VM>> ) -> bool

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 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

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

Get the number of pages that are used.
source§

fn get_available_pages(&self) -> usize

Get the number of pages that are still available for use. The available pages should always be positive or 0.
source§

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>

Get a mutable reference to the base plan. BasePlan is included by all the MMTk GC plans.
source§

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 = Self::VM>>

Return a reference to GenerationalPlan to allow access methods specific to generational plans if the plan is a generational plan.
source§

fn options(&self) -> &Options

Get the current run time options.
source§

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 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

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

Get the total number of pages for the heap.
source§

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 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 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)

Call space.verify_side_metadata_sanity for all spaces in this plan.
source§

impl<VM: VMBinding> PlanTraceObject<VM> for SemiSpace<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 SemiSpace<VM>

§

impl<VM> Send for SemiSpace<VM>

§

impl<VM> Sync for SemiSpace<VM>

§

impl<VM> Unpin for SemiSpace<VM>
where VM: Unpin,

§

impl<VM> !UnwindSafe for SemiSpace<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.