org.jikesrvm.compilers.opt.runtimesupport
Class OptGenericGCMapIterator

java.lang.Object
  extended by org.jikesrvm.mm.mminterface.GCMapIterator
      extended by org.jikesrvm.compilers.opt.runtimesupport.OptGenericGCMapIterator
All Implemented Interfaces:
ArchitectureSpecificOpt.OptGCMapIteratorConstants, PhysicalRegisterConstants, OptGCMapIteratorConstants, Constants, HeapLayoutConstants, RegisterConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants
Direct Known Subclasses:
OptGCMapIterator

public abstract class OptGenericGCMapIterator
extends GCMapIterator
implements ArchitectureSpecificOpt.OptGCMapIteratorConstants, Constants

This class contains its architecture-independent code for iteration across the references represented by a frame built by the OPT compiler.

See Also:
ArchitectureSpecificOpt.OptGCMapIterator

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jikesrvm.ia32.RegisterConstants
RegisterConstants.FloatingPointMachineRegister, RegisterConstants.FPR, RegisterConstants.GPR, RegisterConstants.MachineRegister, RegisterConstants.MM, RegisterConstants.XMM
 
Field Summary
protected  OptCompiledMethod compiledMethod
          The compiled method
private  int currentRegister
          This shows which register to inspect and report on.
private static boolean DEBUG
          just used for debugging, all output statements use VM.syswrite
(package private) static boolean lookForMissedReferencesInRegs
          when set to true, all registers and spills will be inspected for values that look like references.
(package private) static boolean lookForMissedReferencesInSpills
           
private  OptMachineCodeMap map
          The GC map for this method
private  int mapIndex
          Used to index into the GC map
private  Address spillLoc
          This caches the spill location, so that we can check for missed refs hiding in spills
(package private) static boolean VERBOSE
          just used for verbose debugging, all output statements use VM.syswrite
 
Fields inherited from class org.jikesrvm.mm.mminterface.GCMapIterator
framePtr, registerLocations, thread
 
Fields inherited from interface org.jikesrvm.compilers.opt.runtimesupport.ia32.OptGCMapIteratorConstants
FIRST_GCMAP_REG, LAST_GCMAP_REG
 
Fields inherited from interface org.jikesrvm.compilers.opt.regalloc.ia32.PhysicalRegisterConstants
AF, C0, C1, C2, C3, CF, CONDITION_VALUE, DOUBLE_REG, DOUBLE_VALUE, FIRST_DOUBLE, FIRST_INT, FIRST_SPECIAL, FLOAT_VALUE, INT_REG, INT_VALUE, NUM_SPECIALS, NUMBER_TYPE, OF, PF, SF, SPECIAL_REG, ST0, ST1, ZF
 
Fields inherited from interface org.jikesrvm.ia32.RegisterConstants
ALL_FPRS, ALL_GPRS, EAX, EBP, EBX, ECX, EDI, EDX, ESI, ESP, FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, INSTRUCTION_WIDTH, LG_INSTRUCTION_WIDTH, MM0, MM1, MM10, MM11, MM12, MM13, MM14, MM15, MM2, MM3, MM4, MM5, MM6, MM7, MM8, MM9, NATIVE_NONVOLATILE_FPRS, NATIVE_NONVOLATILE_GPRS, NATIVE_PARAMETER_FPRS, NATIVE_PARAMETER_GPRS, NATIVE_VOLATILE_FPRS, NATIVE_VOLATILE_GPRS, NONVOLATILE_FPRS, NONVOLATILE_GPRS, NUM_FPRS, NUM_GPRS, NUM_NONVOLATILE_FPRS, NUM_NONVOLATILE_GPRS, NUM_PARAMETER_FPRS, NUM_PARAMETER_GPRS, NUM_RETURN_FPRS, NUM_RETURN_GPRS, NUM_VOLATILE_FPRS, NUM_VOLATILE_GPRS, PARAMETER_FPRS, PARAMETER_GPRS, R0, R1, R10, R11, R12, R13, R14, R15, R2, R3, R4, R5, R6, R7, R8, R9, RETURN_FPRS, RETURN_GPRS, STACK_POINTER, THREAD_REGISTER, VOLATILE_FPRS, VOLATILE_GPRS, XMM0, XMM1, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9
 
Fields inherited from interface org.jikesrvm.Constants
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK
 
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX
 
Fields inherited from interface org.jikesrvm.HeapLayoutConstants
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE
 
Constructor Summary
protected OptGenericGCMapIterator(WordArray registerLocations)
           
 
Method Summary
(package private)  void checkAllRegistersForMissedReferences()
          This method inspects all the registers for values that look like refs.
(package private)  void checkCurrentRegisterForMissedReferences()
          This method inspects the "current" register for values that look like refs.
(package private)  void checkForMissedSpills(Address ref1, Address ref2)
          This method inspects spill locations between the parameters passed to determine if they look like heap points If the first parameter is 0, it looks from the beginning of the frame until new.
(package private)  void checkRegistersForMissedReferences(int firstReg, int lastReg)
          This method inspects the registers from firstReg to lastReg (inclusive) for values that look like pointers.
 void cleanupPointers()
          scan of this frame is complete clean up any pointers to allow GC to reclaim dead objects
 boolean currentRegisterIsValid()
          Determines if the value of "currentRegister" is valid, or if we processed all registers
 int getCurrentRegister()
          return the current register we are processing
abstract  Address getFirstSpillLoc()
          Get address of the first spill location (The location of spills varies among architectures.)
abstract  Address getLastSpillLoc()
          Get address of the last spill location (The location of spills varies among architectures.)
 Address getNextReferenceAddress()
          Returns the next address that contains a reference
 Address getNextReturnAddressAddress()
          This method is called repeatedly to process derived pointers related to JSRs.
abstract  Address getStackLocation(Address framePtr, int offset)
          Determine the stack location given the frame ptr and spill offset.
 int getType()
          Get the type of this iterator (BASELINE, OPT, etc.).
 void reset()
          Externally visible method called to reset internal state
 void setupIterator(CompiledMethod cm, Offset instructionOffset, Address framePtr)
          Initialize the iterator for another stack frame scan
 void updateCurrentRegister()
          update the state of the current register we are processing
protected abstract  void updateLocateRegisters()
          If any non-volatile gprs were saved by the method being processed then update the registerLocations array with the locations where the registers were saved.
 
Methods inherited from class org.jikesrvm.mm.mminterface.GCMapIterator
newStackWalk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compiledMethod

protected OptCompiledMethod compiledMethod
The compiled method


map

private OptMachineCodeMap map
The GC map for this method


mapIndex

private int mapIndex
Used to index into the GC map


currentRegister

private int currentRegister
This shows which register to inspect and report on. If it is bigger than LAST_GCMAP_REG than we should look at the spills


spillLoc

private Address spillLoc
This caches the spill location, so that we can check for missed refs hiding in spills


DEBUG

private static final boolean DEBUG
just used for debugging, all output statements use VM.syswrite

See Also:
Constant Field Values

VERBOSE

static final boolean VERBOSE
just used for verbose debugging, all output statements use VM.syswrite

See Also:
Constant Field Values

lookForMissedReferencesInRegs

static final boolean lookForMissedReferencesInRegs
when set to true, all registers and spills will be inspected for values that look like references. THIS CAN BE COSTLY. USE WITH CARE

See Also:
Constant Field Values

lookForMissedReferencesInSpills

static final boolean lookForMissedReferencesInSpills
See Also:
Constant Field Values
Constructor Detail

OptGenericGCMapIterator

protected OptGenericGCMapIterator(WordArray registerLocations)
Method Detail

setupIterator

public final void setupIterator(CompiledMethod cm,
                                Offset instructionOffset,
                                Address framePtr)
Initialize the iterator for another stack frame scan

Specified by:
setupIterator in class GCMapIterator
Parameters:
cm - The compiled method we are interested in
instructionOffset - The place in the method where we currently are
framePtr - The current frame pointer

getNextReferenceAddress

public final Address getNextReferenceAddress()
Returns the next address that contains a reference

Specified by:
getNextReferenceAddress in class GCMapIterator
Returns:
the value of the next reference

getNextReturnAddressAddress

public final Address getNextReturnAddressAddress()
This method is called repeatedly to process derived pointers related to JSRs. (They are pointers to code and need to be updated if the code moves.)

Specified by:
getNextReturnAddressAddress in class GCMapIterator
Returns:
the next code pointer or 0 if no more exist

cleanupPointers

public final void cleanupPointers()
scan of this frame is complete clean up any pointers to allow GC to reclaim dead objects

Specified by:
cleanupPointers in class GCMapIterator

getType

public final int getType()
Description copied from class: GCMapIterator
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.

Specified by:
getType in class GCMapIterator
Returns:
type code for this iterator

reset

public final void reset()
Externally visible method called to reset internal state

Specified by:
reset in class GCMapIterator

getCurrentRegister

public final int getCurrentRegister()
return the current register we are processing

Returns:
the current register we are processing

updateCurrentRegister

public final void updateCurrentRegister()
update the state of the current register we are processing


currentRegisterIsValid

public final boolean currentRegisterIsValid()
Determines if the value of "currentRegister" is valid, or if we processed all registers

Returns:
whether the currentRegister is valid

updateLocateRegisters

protected abstract void updateLocateRegisters()
If any non-volatile gprs were saved by the method being processed then update the registerLocations array with the locations where the registers were saved.


getStackLocation

public abstract Address getStackLocation(Address framePtr,
                                         int offset)
Determine the stack location given the frame ptr and spill offset. (The offset direction varies among architectures.)

Parameters:
framePtr - the frame pointer
offset - the offset
Returns:
the resulting stack location

getFirstSpillLoc

public abstract Address getFirstSpillLoc()
Get address of the first spill location (The location of spills varies among architectures.)

Returns:
the first spill location

getLastSpillLoc

public abstract Address getLastSpillLoc()
Get address of the last spill location (The location of spills varies among architectures.)

Returns:
the last spill location

checkCurrentRegisterForMissedReferences

final void checkCurrentRegisterForMissedReferences()
This method inspects the "current" register for values that look like refs.


checkAllRegistersForMissedReferences

final void checkAllRegistersForMissedReferences()
This method inspects all the registers for values that look like refs.


checkRegistersForMissedReferences

final void checkRegistersForMissedReferences(int firstReg,
                                             int lastReg)
This method inspects the registers from firstReg to lastReg (inclusive) for values that look like pointers.

Parameters:
firstReg - first reg to check
lastReg - last reg to check

checkForMissedSpills

final void checkForMissedSpills(Address ref1,
                                Address ref2)
This method inspects spill locations between the parameters passed to determine if they look like heap points If the first parameter is 0, it looks from the beginning of the frame until new.

Parameters:
ref1 - the last spill found as a reference
ref2 - the next spill found as a reference