org.jikesrvm.compilers.baseline.ia32
Class BaselineGCMapIterator

java.lang.Object
  extended by org.jikesrvm.mm.mminterface.GCMapIterator
      extended by org.jikesrvm.compilers.baseline.ia32.BaselineGCMapIterator
All Implemented Interfaces:
Constants, HeapLayoutConstants, ArchConstants, BaselineConstants, RegisterConstants, StackframeLayoutConstants, TrapConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants
Direct Known Subclasses:
ArchitectureSpecific.BaselineGCMapIterator

public abstract class BaselineGCMapIterator
extends GCMapIterator
implements BaselineConstants

Iterator for stack frame built by the Baseline compiler.

An Instance of this class will iterate through a particular reference map of a method returning the offsets of any references that are part of the input parameters, local variables, and java stack for the stack frame.


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
private  int bridgeParameterIndex
          current parameter being mapped (-1 == "this")
private  int bridgeParameterInitialIndex
          first parameter to be mapped (-1 == "this")
private  boolean bridgeParameterMappingRequired
          have all bridge parameters been mapped yet?
private  TypeReference[] bridgeParameterTypes
          parameter types passed by that method
private  int bridgeRegisterIndex
          gpr register it lives in
private  Address bridgeRegisterLocation
          memory address at which that register was saved
private  boolean bridgeRegistersLocationUpdated
          have the register location been updated
private  boolean bridgeSpilledParameterMappingRequired
          do we need to map spilled params (baseline compiler = no, opt = yes)
private  int bridgeSpilledParamInitialOffset
          starting offset to stack location for param0
private  Address bridgeSpilledParamLocation
          current spilled param location
private  MethodReference bridgeTarget
          method to be invoked via dynamic bridge (null: current frame is not a dynamic bridge)
private  boolean counterArrayBase
          have we reported the base ptr of the edge counter array?
private  BaselineCompiledMethod currentCompiledMethod
          Compiled method for the frame
private  NormalMethod currentMethod
          Compiled method for the frame
private  int currentNumLocals
           
private  DynamicLink dynamicLink
          place to keep info returned by CompiledMethod.getDynamicLink
private  boolean finishedWithRegularMap
          have we processed all the values in the regular map yet?
private  int mapId
          id of current map out of all maps
private  int mapIndex
          Current index in current map
private  ReferenceMaps maps
          set of maps for this method
private static boolean TRACE_ALL
           
private static boolean TRACE_DL
           
 
Fields inherited from class org.jikesrvm.mm.mminterface.GCMapIterator
framePtr, registerLocations, thread
 
Fields inherited from interface org.jikesrvm.ia32.BaselineConstants
BRIDGE_FRAME_EXTRA_SIZE, EBP_SAVE_OFFSET, EBX_SAVE_OFFSET, EDI_SAVE_OFFSET, FPU_SAVE_OFFSET, LG_WORDSIZE, S0, S1, SAVED_GPRS, SAVED_GPRS_FOR_SAVE_LS_REGISTERS, SP, STACKFRAME_FIRST_PARAMETER_OFFSET, STACKFRAME_REG_SAVE_OFFSET, T0, T0_int, T0_SAVE_OFFSET, T1, T1_int, T1_SAVE_OFFSET, TR, WORDSIZE, XMM_SAVE_OFFSET
 
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
 
Fields inherited from interface org.jikesrvm.ia32.ArchConstants
SSE2_BASE, SSE2_FULL
 
Fields inherited from interface org.jikesrvm.ia32.StackframeLayoutConstants
BYTES_IN_STACKSLOT, FPU_STATE_SIZE, INVISIBLE_METHOD_ID, LOG_BYTES_IN_STACKSLOT, STACK_SIZE_BOOT, STACK_SIZE_COLLECTOR, STACK_SIZE_DLOPEN, STACK_SIZE_GCDISABLED, STACK_SIZE_GROW, STACK_SIZE_GUARD, STACK_SIZE_JNINATIVE_GROW, STACK_SIZE_MAX, STACK_SIZE_NORMAL, STACK_SIZE_SYSCALL, STACKFRAME_ALIGNMENT, STACKFRAME_BODY_OFFSET, STACKFRAME_FRAME_POINTER_OFFSET, STACKFRAME_HEADER_SIZE, STACKFRAME_METHOD_ID_OFFSET, STACKFRAME_RETURN_ADDRESS_OFFSET, STACKFRAME_SENTINEL_FP, XMM_STATE_SIZE
 
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.ia32.TrapConstants
RVM_TRAP_BASE
 
Constructor Summary
BaselineGCMapIterator(WordArray registerLocations)
          Constructor.
 
Method Summary
 void cleanupPointers()
          Cleanup pointers - used with method maps to release data structures early ... they may be in temporary storage i.e. storage only used during garbage collection
 short convertIndexToLocation(int index)
          Converts a biased index from a local area into an offset in the stack.
private  int convertIndexToOffset(int index)
           
 Address getNextReferenceAddress()
          Get address of next object reference held by current stackframe.
 Address getNextReturnAddressAddress()
          Get address of next JSR return address held by current stackframe.
 int getStackDepth()
          For debugging (used with checkRefMap)
 int getType()
          Get the type of this iterator (BASELINE, OPT, etc.).
 void reset()
          Reset iteration to initial state.
 void setupIterator(CompiledMethod compiledMethod, Offset instructionOffset, Address fp)
          Set the iterator to scan the map at the machine instruction offset provided.
 
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

TRACE_ALL

private static final boolean TRACE_ALL
See Also:
Constant Field Values

TRACE_DL

private static final boolean TRACE_DL
See Also:
Constant Field Values

currentMethod

private NormalMethod currentMethod
Compiled method for the frame


currentCompiledMethod

private BaselineCompiledMethod currentCompiledMethod
Compiled method for the frame


currentNumLocals

private int currentNumLocals

mapIndex

private int mapIndex
Current index in current map


mapId

private int mapId
id of current map out of all maps


maps

private ReferenceMaps maps
set of maps for this method


counterArrayBase

private boolean counterArrayBase
have we reported the base ptr of the edge counter array?


dynamicLink

private final DynamicLink dynamicLink
place to keep info returned by CompiledMethod.getDynamicLink


bridgeTarget

private MethodReference bridgeTarget
method to be invoked via dynamic bridge (null: current frame is not a dynamic bridge)


bridgeParameterTypes

private TypeReference[] bridgeParameterTypes
parameter types passed by that method


bridgeParameterMappingRequired

private boolean bridgeParameterMappingRequired
have all bridge parameters been mapped yet?


bridgeSpilledParameterMappingRequired

private boolean bridgeSpilledParameterMappingRequired
do we need to map spilled params (baseline compiler = no, opt = yes)


bridgeRegistersLocationUpdated

private boolean bridgeRegistersLocationUpdated
have the register location been updated


finishedWithRegularMap

private boolean finishedWithRegularMap
have we processed all the values in the regular map yet?


bridgeParameterInitialIndex

private int bridgeParameterInitialIndex
first parameter to be mapped (-1 == "this")


bridgeParameterIndex

private int bridgeParameterIndex
current parameter being mapped (-1 == "this")


bridgeRegisterIndex

private int bridgeRegisterIndex
gpr register it lives in


bridgeRegisterLocation

private Address bridgeRegisterLocation
memory address at which that register was saved


bridgeSpilledParamLocation

private Address bridgeSpilledParamLocation
current spilled param location


bridgeSpilledParamInitialOffset

private int bridgeSpilledParamInitialOffset
starting offset to stack location for param0

Constructor Detail

BaselineGCMapIterator

public BaselineGCMapIterator(WordArray registerLocations)
Constructor. Remember the location array for registers. This array needs to be updated with the location of any saved registers. This information is not used by this iterator but must be updated for the other types of iterators (ones for the opt compiler built frames) The locations are kept as addresses within the stack.

Method Detail

setupIterator

public void setupIterator(CompiledMethod compiledMethod,
                          Offset instructionOffset,
                          Address fp)
Set the iterator to scan the map at the machine instruction offset provided. The iterator is positioned to the beginning of the map. NOTE: An iterator may be reused to scan a different method and map.

Specified by:
setupIterator in class GCMapIterator
Parameters:
compiledMethod - identifies the method and class
instructionOffset - identifies the map to be scanned.
fp - identifies a specific occurrence of this method and allows for processing instance specific information i.e JSR return address values

reset

public void reset()
Reset iteration to initial state. This allows a map to be scanned multiple times.

Specified by:
reset in class GCMapIterator

convertIndexToLocation

public short convertIndexToLocation(int index)
Converts a biased index from a local area into an offset in the stack.

Parameters:
index - index in the local area (biased : local0 has index 1)
Returns:
corresponding offset in the stack

convertIndexToOffset

private int convertIndexToOffset(int index)

getNextReferenceAddress

public Address getNextReferenceAddress()
Description copied from class: GCMapIterator
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.

Specified by:
getNextReferenceAddress in class GCMapIterator
Returns:
address of word containing an object reference zero if no more references to report

getNextReturnAddressAddress

public Address getNextReturnAddressAddress()
Description copied from class: GCMapIterator
Get address of next JSR return address held by current stackframe.

Specified by:
getNextReturnAddressAddress in class GCMapIterator
Returns:
address of word containing a JSR return address zero if no more return addresses to report

cleanupPointers

public void cleanupPointers()
Cleanup pointers - used with method maps to release data structures early ... they may be in temporary storage i.e. storage only used during garbage collection

Specified by:
cleanupPointers in class GCMapIterator

getType

public 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

getStackDepth

public int getStackDepth()
For debugging (used with checkRefMap)