[][src]Crate mmtk

Memory Management ToolKit (MMTk) is a portable and high performance memory manager that includes various garbage collection algorithms and provides clean and efficient interfaces to cooperate with language implementations. MMTk features highly modular and highly reusable designs. It includes components such as allocators, spaces and work packets that GC implementers can choose from to compose their own GC plan easily.

Logically, this crate includes these major parts:

  • GC components:
    • Allocators: handlers of allocation requests which allocate objects to the bound space.
    • Policies: definitions of semantics and behaviors for memory regions. Each space is an instance of a policy, and takes up a unique proportion of the heap.
    • Work packets: units of GC works scheduled by the MMTk's scheduler.
  • GC plans: GC algorithms composed from components. Note that currently the choice of plans is made through Rust features, which is a build-time config, so only one plan is present in the generated binary and in this documentation. We plan to make this a run-time config so that users can choose GC plans at boot time.
  • Heap implementations: the underlying implementations of memory resources that support spaces.
  • Scheduler: the MMTk scheduler to allow flexible and parallel execution of GC works.
  • Interfaces: bi-directional interfaces between MMTk and language implementations i.e. the memory manager API that allows a language's memory manager to use MMTk and the VMBinding trait that allows MMTk to call the language implementation.

Re-exports

pub use crate::plan::selected_plan::SelectedConstraints;
pub use crate::plan::selected_plan::SelectedPlan;

Modules

memory_manager

VM-to-MMTk interface: safe Rust APIs.

policy

Memory policies that can be used for spaces.

scheduler

A general scheduler implementation. MMTk uses it to schedule GC-related works.

util

Utilities used by other modules, including allocators, heap implementation, etc.

vm

MMTk-to-VM interface: the VMBinding trait.

Structs

MMTK

An MMTk instance. MMTk allows mutiple instances to run independently, and each instance gives users a separate heap. Note that multi-instances is not fully supported yet

Mutator

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.

Enums

AllocationSemantics

Allocation semantics that MMTk provides. Each allocation request requires a desired semantic for the object to allocate.

Traits

CopyContext

A GC worker's context for copying GCs. Each GC plan should provide their implementation of a CopyContext. For non-copying GC, NoCopy can be used.

MutatorContext

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.

Plan

A plan describes the global core functionality for all memory management schemes. All global MMTk plans should implement this trait.

TraceLocal

This trait and its global counterpart implement the core functionality for a transitive closure over the heap graph. This trait specifically implements the unsynchronized thread-local component (ie the 'fast-path') of the trace mechanism.

TransitiveClosure

This trait is the fundamental mechanism for performing a transitive closure over an object graph.