Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The main operation of a tracing collector is the transitive closure operation where all (or a subset) of the object graph is visited.  Some collectors such as generational collectors perform these operations in more than one way, e.g. a nursery collection in a generational collector does not trace through pointers into the mature space, while a full-heap collection does.  All MMTk collectors are designed to run using several parallel threads, using data structures that have unsynchronized thread-local and synchronized global components in the same way as MMTk's policy classes.

MMTk's trace operation uses the following terminology:

  • An edge is a reference in the heap from one reference field to the object (or node) it points to.
  • Tracing an object is the policy-defined operation performed by the collector on an object.  In a mark-sweep policy this means setting the mark state of the object.  In a copying policy this means moving the object to its new location.
  • Scanning ...

Each distinct transitive closure operation is defined as a subclass of TraceLocal.  The closure is performed in the collectionPhase method of the CollectorContext class

Code Block
titleMSCollector.java
languagejava
  public void collectionPhase(short phaseId, boolean primary) {
    ...
    if (phaseId == MS.CLOSURE) {
      fullTrace.completeTrace();
      return;
    }
    ...
  }

The initial starting point for the closure is computed by the STACK_ROOTS and ROOTS phases, which add root locations to a buffer by calling TraceLocal.reportDelayedRootEdge.  The closure operation proceeds by invoking traceObiect on each root location (in method processRootEdge), and then invoking scanObject on each heap object encountered.