Module mmtk::plan

source ·
Expand description

GC algorithms from the MMTk suite.

This module provides various GC plans, each of which implements a GC algorithm. Generally a plan consists of a few parts:

  • A plan type that implements the Plan trait, which defines spaces used in the plan, and their behaviors in GC and page accounting.
  • A mutator definition, which describes the mapping between allocators and allocation semantics, and the mapping between allocators and spaces. If the plan needs barrier, the barrier definition is also included here.
  • A constant for PlanConstraints, which defines plan-specific constants.
  • Plan-specific GCWork, which is scheduled during GC.

For more about implementing a plan, it is recommended to read the MMTk tutorial.


  • barriers 🔒
    Read/Write barrier implementations.
  • Generational plans (with a copying nursery) Generational plans
  • global 🔒
    The global part of a plan implementation.
  • immix 🔒
  • marksweep 🔒
    Plan: marksweep
  • Mutator context for each application thread.
  • nogc 🔒
    Plan: nogc (allocation-only)
  • Plan: pageprotect
  • Plan-specific constraints.
  • semispace 🔒
    Plan: semispace
  • sticky 🔒
    Sticky plans (using sticky marks for generational behaviors without a copying nursery)
  • tracing 🔒
    This module contains code useful for tracing, i.e. visiting the reachable objects by traversing all or part of an object graph.


  • A mutator is a per-thread data structure that manages allocations and barriers. It is usually highly coupled with the language VM. It is recommended for MMTk users 1) to have a mutator struct of the same layout in the thread local storage that can be accessed efficiently, and 2) to implement fastpath allocation and barriers for the mutator in the VM side.
  • A transitive closure visitor to collect the slots from objects. It maintains a buffer for the slots, and flushes slots to a new work packet if the buffer is full or if the type gets dropped.
  • This struct defines plan-specific constraints. Most of the constraints are constants. Each plan should declare a constant of this struct, and use the constant wherever possible. However, for plan-neutral implementations, these constraints are not constant.
  • An implementation of ObjectQueue using a Vec.


  • Allocation semantics that MMTk provides. Each allocation request requires a desired semantic for the object to allocate.
  • BarrierSelector describes which barrier to use.



  • Each GC plan should provide their implementation of a MutatorContext. Note that this trait is no longer needed as we removed per-plan mutator implementation and we will remove this trait as well in the future.
  • This trait represents an object queue to enqueue objects during tracing.
  • A plan describes the global core functionality for all memory management schemes. All global MMTk plans should implement this trait.

Type Aliases§