org.jikesrvm.mm.mmtk
Class Scanning

java.lang.Object
  extended by org.mmtk.vm.Scanning
      extended by org.jikesrvm.mm.mmtk.Scanning
All Implemented Interfaces:
Constants

public final class Scanning
extends Scanning
implements Constants


Field Summary
private static SynchronizedCounter threadCounter
          Counter to track index into thread table for root tracing.
 
Fields inherited from interface org.mmtk.utility.Constants
ALIGNMENT_VALUE, ARRAY_ELEMENT, BITS_IN_ADDRESS, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_INT, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_INT, BYTES_IN_KBYTE, BYTES_IN_MBYTE, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, CARD_MASK, CARD_META_PAGES_PER_REGION, INSTANCE_FIELD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_INT, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_ADDRESS_SPACE, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_INT, LOG_BYTES_IN_KBYTE, LOG_BYTES_IN_MBYTE, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD, LOG_CARD_BYTES, LOG_CARD_GRAIN, LOG_CARD_META_BYTES, LOG_CARD_META_PAGES, LOG_CARD_META_SIZE, LOG_CARD_UNITS, LOG_MIN_ALIGNMENT, MAX_ALIGNMENT, MAX_BYTES_PADDING, MAX_INT, MIN_ALIGNMENT, MIN_INT, SUPPORT_CARD_SCANNING
 
Constructor Summary
Scanning()
           
 
Method Summary
 void computeBootImageRoots(TraceLocal trace)
          Compute all roots out of the VM's boot image (if any).
 void computeGlobalRoots(TraceLocal trace)
          Computes global roots.
 void computeStaticRoots(TraceLocal trace)
          Computes static roots.
 void computeThreadRoots(TraceLocal trace)
          Computes roots pointed to by threads, their associated registers and stacks.
 void notifyInitialThreadScanComplete()
          Called the first time during a collection that thread's stacks have been scanned.
 void resetThreadCounter()
          Prepares for using the computeAllRoots method.
 void scanObject(TransitiveClosure trace, ObjectReference object)
          Scanning of a object, processing each pointer field encountered.
 void specializedScanObject(int id, TransitiveClosure trace, ObjectReference object)
          Invoke a specialized scan method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadCounter

private static final SynchronizedCounter threadCounter
Counter to track index into thread table for root tracing.

Constructor Detail

Scanning

public Scanning()
Method Detail

scanObject

public void scanObject(TransitiveClosure trace,
                       ObjectReference object)
Scanning of a object, processing each pointer field encountered.

Specified by:
scanObject in class Scanning
Parameters:
trace - The closure being used.
object - The object to be scanned.

specializedScanObject

public void specializedScanObject(int id,
                                  TransitiveClosure trace,
                                  ObjectReference object)
Description copied from class: Scanning
Invoke a specialized scan method. Note that these methods must have been allocated explicitly through Plan and PlanConstraints.

Specified by:
specializedScanObject in class Scanning
Parameters:
id - The specialized method id
trace - The trace the method has been specialized for
object - The object to be scanned

resetThreadCounter

public void resetThreadCounter()
Description copied from class: Scanning
Prepares for using the computeAllRoots method. The thread counter allows multiple GC threads to co-operatively iterate through the thread data structure (if load balancing parallel GC threads were not important, the thread counter could simply be replaced by a for loop).

Specified by:
resetThreadCounter in class Scanning

notifyInitialThreadScanComplete

public void notifyInitialThreadScanComplete()
Description copied from class: Scanning
Called the first time during a collection that thread's stacks have been scanned. This can be used (for example) to clean up obsolete compiled methods that are no longer being executed.

Specified by:
notifyInitialThreadScanComplete in class Scanning

computeStaticRoots

public void computeStaticRoots(TraceLocal trace)
Computes static roots. This method establishes all such roots for collection and places them in the root locations queue. This method should not have side effects (such as copying or forwarding of objects). There are a number of important preconditions:

Specified by:
computeStaticRoots in class Scanning
Parameters:
trace - The trace to use for computing roots.

computeGlobalRoots

public void computeGlobalRoots(TraceLocal trace)
Computes global roots. This method establishes all such roots for collection and places them in the root locations queue. This method should not have side effects (such as copying or forwarding of objects). There are a number of important preconditions:

Specified by:
computeGlobalRoots in class Scanning
Parameters:
trace - The trace to use for computing roots.

computeThreadRoots

public void computeThreadRoots(TraceLocal trace)
Computes roots pointed to by threads, their associated registers and stacks. This method places these roots in the root values, root locations and interior root locations queues. This method should not have side effects (such as copying or forwarding of objects). There are a number of important preconditions: TODO try to rewrite using chunking to avoid the per-thread synchronization?

Specified by:
computeThreadRoots in class Scanning
Parameters:
trace - The trace to use for computing roots.

computeBootImageRoots

public void computeBootImageRoots(TraceLocal trace)
Description copied from class: Scanning
Compute all roots out of the VM's boot image (if any). This method is a no-op in the case where the VM does not maintain an MMTk-visible Java space. However, when the VM does maintain a space (such as a boot image) which is visible to MMTk, that space could either be scanned by MMTk as part of its transitive closure over the whole heap, or as a (considerable) performance optimization, MMTk could avoid scanning the space if it is aware of all pointers out of that space. This method is used to establish the root set out of the scannable space in the case where such a space exists.

Specified by:
computeBootImageRoots in class Scanning
Parameters:
trace - The trace object to use to report root locations.