pub trait GCWorkContext: Send + 'static {
type VM: VMBinding;
type PlanType: Plan<VM = Self::VM>;
type DefaultTrace: Trace<VM = Self::VM>;
type PinningTrace: Trace<VM = Self::VM>;
// Provided method
fn make_roots_work_factory(
mmtk: &'static MMTK<Self::VM>,
) -> impl RootsWorkFactory<<Self::VM as VMBinding>::VMSlot> { ... }
}Expand description
This trait provides a group of associated types that are needed to
create GC work packets for a certain plan. For example, GCWorkScheduler.schedule_common_work()
needs this trait to schedule different work packets. For certain plans,
they may need to provide several types that implement this trait, e.g. one for
nursery GC, one for mature GC.
Note: Because GCWorkContext is often used as parameters of implementations of GCWork, we
let GCWorkContext require Send + 'static. Since GCWorkContext is just a group of
associated types, its implementations should not have any actual fields other than
PhantomData, and will automatically have Send + 'static.
Required Associated Types§
type VM: VMBinding
type PlanType: Plan<VM = Self::VM>
Sourcetype DefaultTrace: Trace<VM = Self::VM>
type DefaultTrace: Trace<VM = Self::VM>
The Trace implementation to use for tracing edges that do not have special pinning
requirements. Concrete plans and spaces may choose to move or not to move the objects the
traced edges point to.
Sourcetype PinningTrace: Trace<VM = Self::VM>
type PinningTrace: Trace<VM = Self::VM>
The Trace implementation to use for tracing edges that must not be updated (i.e. the
objects the traced edges pointed to must not be moved). This is used for implementing
pinning roots and transitive pinning roots.
- For non-transitive pinning roots,
Self::PinningTracewill be used to trace the edges from roots to objects, but their descendents will be traced usingSelf::DefaultTrace. - For transitive pinning roots,
Self::PinningTracewill be used to trace the edges from roots to objects, and will also be used to trace the outgoing edges of all objects reachable from transitive pinning roots.
If a plan does not support object pinning, it should use UnsupportedTrace for this type
member.
Provided Methods§
Sourcefn make_roots_work_factory(
mmtk: &'static MMTK<Self::VM>,
) -> impl RootsWorkFactory<<Self::VM as VMBinding>::VMSlot>
fn make_roots_work_factory( mmtk: &'static MMTK<Self::VM>, ) -> impl RootsWorkFactory<<Self::VM as VMBinding>::VMSlot>
Create an instance of RootsWorkFactory for root scanning in the current GC.
The default implementation creates DefaultRootsWorkFactory which is sufficient for
stop-the-world tracing GC. Plans that need custom RootsWorkFactory implementations can
override this method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.