org.jikesrvm.mm.mminterface
Class GCMapIterator

java.lang.Object
  extended by org.jikesrvm.mm.mminterface.GCMapIterator
Direct Known Subclasses:
BaselineGCMapIterator, HardwareTrapGCMapIterator, JNIGCMapIterator, OptGenericGCMapIterator

public abstract class GCMapIterator
extends Object

Base class for iterators that identify object references and JSR return addresses held in stackframes produced by each of our compilers (baseline, opt, etc.). All compiler specific GCMapIterators extend this abstract class.

See Also:
GCMapIteratorGroup

Field Summary
 Address framePtr
          address of stackframe currently being scanned
 WordArray registerLocations
          address where each gpr register was saved by previously scanned stackframe(s)
 RVMThread thread
          thread whose stack is currently being scanned
 
Constructor Summary
GCMapIterator()
           
 
Method Summary
abstract  void cleanupPointers()
          Iteration is complete, release any internal data structures including locks acquired during setupIterator for jsr maps.
abstract  Address getNextReferenceAddress()
          Get address of next object reference held by current stackframe.
abstract  Address getNextReturnAddressAddress()
          Get address of next JSR return address held by current stackframe.
abstract  int getType()
          Get the type of this iterator (BASELINE, OPT, etc.).
 void newStackWalk(RVMThread thread)
          Prepare to scan a thread's stack and saved registers for object references.
abstract  void reset()
          Prepare to re-iterate on same stackframe, and to switch between "reference" iteration and "JSR return address" iteration.
abstract  void setupIterator(CompiledMethod compiledMethod, Offset instructionOffset, Address framePtr)
          Prepare to iterate over object references and JSR return addresses held by a stackframe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thread

public RVMThread thread
thread whose stack is currently being scanned


framePtr

public Address framePtr
address of stackframe currently being scanned


registerLocations

public WordArray registerLocations
address where each gpr register was saved by previously scanned stackframe(s)

Constructor Detail

GCMapIterator

public GCMapIterator()
Method Detail

newStackWalk

public void newStackWalk(RVMThread thread)
Prepare to scan a thread's stack and saved registers for object references.

Parameters:
thread - Thread whose stack is being scanned

setupIterator

public abstract void setupIterator(CompiledMethod compiledMethod,
                                   Offset instructionOffset,
                                   Address framePtr)
Prepare to iterate over object references and JSR return addresses held by a stackframe.

Parameters:
compiledMethod - method running in the stackframe
instructionOffset - offset of current instruction within that method's code
framePtr - address of stackframe to be visited

getNextReferenceAddress

public abstract Address getNextReferenceAddress()
Get address of next object reference held by current stackframe. Returns zero when there are no more references to report.

Side effect: registerLocations[] updated at end of iteration. TODO: registerLocations[] update should be done via separately called method instead of as side effect.

Returns:
address of word containing an object reference zero if no more references to report

getNextReturnAddressAddress

public abstract Address getNextReturnAddressAddress()
Get address of next JSR return address held by current stackframe.

Returns:
address of word containing a JSR return address zero if no more return addresses to report

reset

public abstract void reset()
Prepare to re-iterate on same stackframe, and to switch between "reference" iteration and "JSR return address" iteration.


cleanupPointers

public abstract void cleanupPointers()
Iteration is complete, release any internal data structures including locks acquired during setupIterator for jsr maps.


getType

public abstract int getType()
Get the type of this iterator (BASELINE, OPT, etc.). Called from GCMapIteratorGroup to select which iterator to use for a stackframe. The possible types are specified in CompiledMethod.

Returns:
type code for this iterator