org.jikesrvm.compilers.opt.runtimesupport
Class OptGCMap

java.lang.Object
  extended by org.jikesrvm.compilers.opt.runtimesupport.OptGCMap
All Implemented Interfaces:
ArchitectureSpecificOpt.OptGCMapIteratorConstants, PhysicalRegisterConstants, OptGCMapIteratorConstants, RegisterConstants

public final class OptGCMap
extends Object
implements ArchitectureSpecificOpt.OptGCMapIteratorConstants

A class that encapsulates the GCMap portion of the machine code maps. An instance of this class is created to encode and instance of a GCIRMap into an int[]. The int[] is stored persistently, but the instance of the OptGCMap is NOT.

Note: This file contains two types of methods


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
static boolean DEBUG
           
static int ERROR
           
private  int[] gcMapInformation
          The gc map array, a sequence of gc maps.
static int INITIAL_MAP_SIZE
          The initial allocation size for a map
private  int lastGCMapEntry
          the index of the last map entry in use
private static int NEXT_BIT
          bit pattern for the "next" bit in the GC maps array
static int NO_MAP_ENTRY
           
 
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
 
Constructor Summary
OptGCMap()
          Constructor, called during compilation
 
Method Summary
private  void addAllSpills(int[] spillArray)
          If we will be looking for missed references we need to sort the list of spills and then add them to the map, otherwise, nothing to do
private  void addSpillLocation(int spill)
          Adds the passed spill value to the current map
static void dumpMap(int entry, int[] gcMap)
          Dumps the GCmap that starts at entry.
private  int endCurrentMap(int firstIndex)
          Ends the current map
 int[] finish()
          Called to complete the encoding and return the final int[]
static int gcMapInformation(int entry, int[] gcMap)
          Returns the GC map information for the GC map information entry passed
 int generateGCMapEntry(GCIRMapElement irMapElem)
          Construct the GCMap for the argument GCIRMapElement
private  int getNextMapEntry()
          Returns the next GC map entry for use
private static int getRegBitPosition(int registerNumber)
          This method maps a register number to its bit position
private static boolean nextBitSet(int entry, int[] gcMap)
          Determines if the next bit is set for the entry passed in the gc map passed
static int nextLocation(int currentIndex, int[] gcMap)
           
static boolean registerIsSet(int entry, int registerNumber, int[] gcMap)
          Determines if the register map information for the entry passed is true
private  void resizeMapInformation(int newSize)
          Resize the map array
private  int setRegisterBitMap(int bitMap)
          Sets the register map information at the next available entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MAP_ENTRY

public static final int NO_MAP_ENTRY
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

INITIAL_MAP_SIZE

public static final int INITIAL_MAP_SIZE
The initial allocation size for a map

See Also:
Constant Field Values

NEXT_BIT

private static final int NEXT_BIT
bit pattern for the "next" bit in the GC maps array

See Also:
Constant Field Values

lastGCMapEntry

private int lastGCMapEntry
the index of the last map entry in use


gcMapInformation

private int[] gcMapInformation
The gc map array, a sequence of gc maps. Each sequence starts with a register bit mask and is followed by a list of spills. The most significant bit of the spill location is used to chain the list.


DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

OptGCMap

OptGCMap()
Constructor, called during compilation

Method Detail

finish

public int[] finish()
Called to complete the encoding and return the final int[]


generateGCMapEntry

public int generateGCMapEntry(GCIRMapElement irMapElem)
Construct the GCMap for the argument GCIRMapElement

Parameters:
irMapElem - The IR Map element to create a GCMap for
Returns:
the GCMap index.

gcMapInformation

public static int gcMapInformation(int entry,
                                   int[] gcMap)
Returns the GC map information for the GC map information entry passed

Parameters:
entry - map entry
gcMap - the gc map

registerIsSet

public static boolean registerIsSet(int entry,
                                    int registerNumber,
                                    int[] gcMap)
Determines if the register map information for the entry passed is true

Parameters:
entry - map entry
registerNumber - the register number
gcMap - the encoded GCMap

nextLocation

public static int nextLocation(int currentIndex,
                               int[] gcMap)
Parameters:
gcMap - the encoded GCMap
Returns:
the next (relative) location or -1 for no more locations

getRegBitPosition

private static int getRegBitPosition(int registerNumber)
This method maps a register number to its bit position

Parameters:
registerNumber - the register number of interest

nextBitSet

private static boolean nextBitSet(int entry,
                                  int[] gcMap)
Determines if the next bit is set for the entry passed in the gc map passed

Parameters:
entry - the entry (index) to check
gcMap - the gcmap
Returns:
whether the next bit is set

dumpMap

public static void dumpMap(int entry,
                           int[] gcMap)
Dumps the GCmap that starts at entry.

Parameters:
entry - the entry where the map begins
gcMap - the encoded GCmaps

getNextMapEntry

private int getNextMapEntry()
Returns the next GC map entry for use

Returns:
the entry in the map table that can be used

resizeMapInformation

private void resizeMapInformation(int newSize)
Resize the map array

Parameters:
newSize - the new size for the map array

setRegisterBitMap

private int setRegisterBitMap(int bitMap)
Sets the register map information at the next available entry

Parameters:
bitMap - map entry
Returns:
The index of that entry.

addAllSpills

private void addAllSpills(int[] spillArray)
If we will be looking for missed references we need to sort the list of spills and then add them to the map, otherwise, nothing to do

Parameters:
spillArray - an array of spills

addSpillLocation

private void addSpillLocation(int spill)
Adds the passed spill value to the current map

Parameters:
spill - the spill location

endCurrentMap

private int endCurrentMap(int firstIndex)
Ends the current map

Parameters:
firstIndex - the index of the beginning of the map
Returns:
the index of the beginning of the map (may be different)