org.mmtk.policy
Class MarkCompactCollector

java.lang.Object
  extended by org.mmtk.policy.MarkCompactCollector

public final class MarkCompactCollector
extends Object

This class implements unsynchronized (local) per-collector-thread elements of a sliding mark-compact collector.

Specifically, this class provides the methods that

Each collector thread maintains a private list of the pages that it compacts. If it runs out of work during the calculateForwardingPointers pass, it requests a new region from the global MarkCompactSpace. Regions compacted by a collector remain local to the collector.

See Also:
MarkCompactSpace, MarkCompactLocal

Nested Class Summary
private static class MarkCompactCollector.FromCursor
          Subclass for the read-only cursor that leads the scan of regions.
private static class MarkCompactCollector.RegionCursor
          Both the 'compact' and 'calculate' phases can be thought of as sweeping a pair of cursors across a linked list of regions.
private static class MarkCompactCollector.ToCursor
          Subclass for the read-only cursor that follows the 'from' cursor, writing or calculating the position of copied objects
 
Field Summary
private  MarkCompactCollector.FromCursor fromCursor
           
private  Address regions
          This collector's work list
private  MarkCompactSpace space
           
private  MarkCompactCollector.ToCursor toCursor
           
(package private) static boolean VERBOSE
           
(package private) static boolean VERY_VERBOSE
           
 
Constructor Summary
MarkCompactCollector(MarkCompactSpace space)
          Constructor
 
Method Summary
 void calculateForwardingPointers()
          Perform a linear scan through the objects allocated by this bump pointer, calculating where each live object will be post collection.
 void compact()
          Perform the compacting phase of the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

static final boolean VERBOSE
See Also:
Constant Field Values

VERY_VERBOSE

static final boolean VERY_VERBOSE
See Also:
Constant Field Values

space

private final MarkCompactSpace space

regions

private Address regions
This collector's work list


fromCursor

private final MarkCompactCollector.FromCursor fromCursor

toCursor

private final MarkCompactCollector.ToCursor toCursor
Constructor Detail

MarkCompactCollector

public MarkCompactCollector(MarkCompactSpace space)
Constructor

Parameters:
space - The space to bump point into.
Method Detail

calculateForwardingPointers

public void calculateForwardingPointers()
Perform a linear scan through the objects allocated by this bump pointer, calculating where each live object will be post collection.

We maintain two cursors, fromCursor and toCursor, and simulate copying live objects from the former to the latter. Initially, the cursors point to the first region in this collector's local list, and increment in lockstep until the first dead object is encountered. After that, the to cursor trails the from cursor.

The outer loop advances the 'from' pointer


compact

public void compact()
Perform the compacting phase of the collection.