mmtk 0.33.0

MMTk is a framework for the design and implementation of high-performance and portable memory managers.
Documentation
use crate::plan::concurrent::concurrent_marking_work::ConcurrentMarkingRootsWorkFactory;
use crate::plan::concurrent::immix::global::ConcurrentImmix;
use crate::plan::tracing::PlanTrace;
use crate::policy::gc_work::{TraceKind, TRACE_KIND_TRANSITIVE_PIN};
use crate::policy::immix::TRACE_KIND_FAST;
use crate::vm::VMBinding;

/// The `GCWorkContext` implementation for the fall-back stop-the-world GC in ConcurrentImmix.
pub(super) struct ConcurrentImmixSTWGCWorkContext<VM: VMBinding, const KIND: TraceKind>(
    std::marker::PhantomData<VM>,
);

impl<VM: VMBinding, const KIND: TraceKind> crate::scheduler::GCWorkContext
    for ConcurrentImmixSTWGCWorkContext<VM, KIND>
{
    type VM = VM;
    type PlanType = ConcurrentImmix<VM>;
    type DefaultTrace = PlanTrace<ConcurrentImmix<VM>, KIND>;
    type PinningTrace = PlanTrace<ConcurrentImmix<VM>, TRACE_KIND_TRANSITIVE_PIN>;
}

/// The `GCWorkContext` implementation for concurrent marking.  Note that it overrides the
/// `RootsWorkFactory`.
pub(super) struct ConcurrentImmixGCWorkContext<VM>(std::marker::PhantomData<VM>);

impl<VM: VMBinding> crate::scheduler::GCWorkContext for ConcurrentImmixGCWorkContext<VM> {
    type VM = VM;
    type PlanType = ConcurrentImmix<VM>;
    type DefaultTrace = PlanTrace<Self::PlanType, TRACE_KIND_FAST>;
    type PinningTrace = PlanTrace<Self::PlanType, TRACE_KIND_FAST>;

    fn make_roots_work_factory(
        mmtk: &'static crate::MMTK<Self::VM>,
    ) -> impl crate::vm::RootsWorkFactory<<Self::VM as VMBinding>::VMSlot> {
        ConcurrentMarkingRootsWorkFactory::<Self::VM, Self::PlanType, TRACE_KIND_FAST>::new(mmtk)
    }
}