Trait mmtk::plan::global::HasSpaces

source ·
pub trait HasSpaces {
    type VM: VMBinding;

    // Required methods
    fn for_each_space(&self, func: &mut dyn FnMut(&dyn Space<Self::VM>));
    fn for_each_space_mut(
        &mut self,
        func: &mut dyn FnMut(&mut dyn Space<Self::VM>)
    );
}
Expand description

A trait for anything that contains spaces. Examples include concrete plans as well as Gen, CommonPlan and BasePlan. All plans must implement this trait.

This trait provides methods for enumerating spaces in a struct, including spaces in nested struct.

This trait can be implemented automatically by adding the #[derive(HasSpaces)] attribute to a struct. It uses the derive macro defined in the mmtk-macros crate.

This trait visits spaces as dyn, so it should only be used when performance is not critical. For performance critical methods that visit spaces in a plan, such as trace_object, it is recommended to define a trait (such as PlanTraceObject) for concrete plans to implement, and implement (by hand or automatically) the method without dyn.

Required Associated Types§

Required Methods§

source

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

Visit each space field immutably.

If Self contains nested fields that contain more spaces, this method shall visit spaces in the outer struct first.

source

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

Visit each space field mutably.

If Self contains nested fields that contain more spaces, this method shall visit spaces in the outer struct first.

Implementors§

source§

impl<VM: VMBinding> HasSpaces for GenCopy<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for CommonGenPlan<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for GenImmix<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for Immix<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for MarkCompact<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for MarkSweep<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for NoGC<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for PageProtect<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for SemiSpace<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for StickyImmix<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for BasePlan<VM>

§

type VM = VM

source§

impl<VM: VMBinding> HasSpaces for CommonPlan<VM>

§

type VM = VM