|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.compilers.baseline.ReferenceMaps
public final class ReferenceMaps
class that provides stack (and local var) map for a baseline compiled method GC uses the methods provided here
| Nested Class Summary | |
|---|---|
private static class |
ReferenceMaps.MergeOperation
Kinds of merge operation when merging delta maps into table maps |
| 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 static int |
BITS_PER_MAP_ELEMENT
Number of bits in each map element |
private int |
bitsPerMap
Number of bits in each map |
static byte |
JSR_INDEX_MASK
|
static byte |
JSR_MASK
|
private JSRInfo |
jsrInfo
|
static SpinLock |
jsrLock
Serializes JSR processing |
private int |
mapCount
Number of maps |
private int[] |
MCSites
|
static int |
NOMORE
|
private byte[] |
referenceMaps
|
static int |
STARTINDEX
|
| 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_SAVE_OFFSET, T1, 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.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.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 | |
|---|---|
ReferenceMaps(BaselineCompiledMethod cm,
int[] stackHeights,
byte[] localTypes)
|
|
| Method Summary | |
|---|---|
private int |
addUnusualMap(UnusualMaps jsrSiteMap)
Add an UnusualMap to the array of unusual maps, expand the array and referencemap array if necessary |
private int |
bytesPerMap()
size of individul maps |
void |
cleanupPointers()
This routine is used to clean out the MethodMap of structures that were allocated from temporary storage. |
private UnusualMaps |
combineDeltaMaps(int jsrUnusualMapid)
merge unusual maps- occurs in nested jsr conditions merge each nested delta map ( as represented by the jsrMapid of the location site) into the jsrInfo.extraUnusualMap where the deltas are accumulated NOTE: while the routine is written to combine 2 jsrInfo.unusualMaps in general in reality the target map is always the same ( the jsrInfo.extraUnusualMap) |
private byte |
convertMapElement(byte[] curBBMap,
int offset,
int len,
byte reftype)
convert a portion of an array word of Bytes into a bitmap of references ie given a byte array, a starting offset in the array, the length to scan, and the type of byte to scan for ... convert the area in the array to a word of bits ... max length is 31 ie BITS_PER_MAP_ELEMENT |
private void |
copyBitMap(int extramapindex,
int index)
subroutine to copy a bitmap into the extra unusualmap inputs the index of the map in the jsrInfo.extraUnusualMap ie the "to" map the index of the map to copy ie the "from" map mapid is used to get the length of the map output is in the extraunusual map |
private void |
finalMergeMaps(int jsrBaseMapIndex,
UnusualMaps deltaMap)
This method will merge the jsr invoker's base map with changes due to *all* nested jsr subroutines. |
(package private) int |
findUnusualMap(int mapid)
This routine is used to find an Unusual map with an index greater than 127 it returns the index by doing a sequential scan and looking for the mapid in the normal map directory |
int |
getNextJSRAddressIndex(Offset nextMachineCodeOffset,
NormalMethod m)
|
int |
getNextJSRRefIndex(int index)
|
int |
getNextJSRReturnAddrIndex(int index)
Given an offset in the jsr returnAddress map, return the offset where the next returnAddress can be found. |
private int |
getNextMapElement()
get Next free word in referencemaps for gc call sites |
int |
getNextRefIndex(int index,
int siteindex)
|
int |
getStackDepth(int mapid)
For debugging (used with CheckRefMaps) Note: all maps are the same size |
boolean |
isLocalRefType(RVMMethod method,
Offset mcoff,
int lidx)
Query if a local variable has a reference type value |
int |
locateGCPoint(Offset machCodeOffset,
RVMMethod method)
Given a machine code instruction offset, return an index to identify the stack map closest to the offset ( but not beyond) Usage note: "machCodeOffset" must point to the instruction *following* the actual instruction whose stack map is sought. |
private void |
mergeMap(int targetindex,
int deltaindex,
ReferenceMaps.MergeOperation Op)
Merge a delta map (as represented by its index in the referencemap table) into a target map (similarly represented) and use the operation indicated ( OR or NAND or COPY) |
void |
recordingComplete()
Called when all the recording for this map is complete. |
void |
recordJSRSubroutineMap(int byteindex,
byte[] currReferenceMap,
int BBLastPtr,
int returnAddrIndex,
boolean replacemap)
Record a map for a point within a JSR Subroutine. |
void |
recordStkMap(int byteindex,
byte[] byteMap,
int BBLastPtr,
boolean replacemap)
Given the information about a GC point, record the information in the proper tables The information is the following the index in the bytecode of this site, a byte array that describes the contents of the local variables and the java stack, the last offset of a byte that contains information about the map, a boolean to indicate that this map is a replacement for a currently existing map. |
private int |
scanByte(int bitnum,
int bytenum,
int toscan,
byte[] map)
given a bitnumber in a map, the index of the corresponding map byte, and the remaining number of bits in the byte, this routine scans forward to find the next ref in the byte or return zero if not found |
(package private) int |
scanByteArray(byte[] byteMap,
int BBLastPtr,
byte refType,
int mapslot,
boolean skipOneBit)
given a bytearray where each byte describes the corresponding word on a stack, the length of the byte array, and the type of information that is desired to be scanned this subroutine scans the byte array looking for the type of information requested and builds a bit array in the stack maps with the information Skip one bits in the bitarray if skipOnBit is true - we need to skip one bit for setRef and setNonRef maps so they are properly merged with jsr base maps. |
private int |
scanForNextRef(int bitnum,
int wordnum,
int remaining,
byte[] map)
given a starting bitnumber in a map, the index of the corresponding byte, and the remaining number of bits in the map, this routine scans forward to find the next ref in the map (inclusive search ie include bitnum) |
int |
setupJSRSubroutineMap(int mapid)
Setup a map within a JSR Subroutine. |
void |
showAMap(int MCSiteIndex)
Show the basic information for a single map. |
void |
showInfo()
show the basic information for each of the maps this is for testing use |
void |
showOffsets()
Show the offsets for all the maps. |
int |
showReferenceMapStatistics(RVMMethod method)
|
int |
size()
|
void |
startNewMaps(int gcPointCount,
int jsrCount,
int parameterWords)
start setting up the reference maps for this method. |
void |
translateByte2Machine(int[] b2m)
After code is generated, translate the bytecode indices recorded in MCSites array into real machine code offsets. |
private void |
unusualMapcopy(UnusualMaps from)
subroutine to deep copy an UnusualMap into the jsrInfo.extraUnusualMap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte JSR_MASK
public static final byte JSR_INDEX_MASK
public static final int STARTINDEX
public static final int NOMORE
public static final SpinLock jsrLock
private static final int BITS_PER_MAP_ELEMENT
private byte[] referenceMaps
private int[] MCSites
private final int bitsPerMap
private int mapCount
private JSRInfo jsrInfo
| Constructor Detail |
|---|
ReferenceMaps(BaselineCompiledMethod cm,
int[] stackHeights,
byte[] localTypes)
| Method Detail |
|---|
private int bytesPerMap()
public int locateGCPoint(Offset machCodeOffset,
RVMMethod method)
public int getNextRefIndex(int index,
int siteindex)
index - offset in the reference stack frame,siteindex - index that indicates the callsite (siteindex),
public int getNextJSRRefIndex(int index)
index - offset in the JSR reference map,
public int getNextJSRReturnAddrIndex(int index)
public int getStackDepth(int mapid)
public int size()
public void startNewMaps(int gcPointCount,
int jsrCount,
int parameterWords)
public void recordStkMap(int byteindex,
byte[] byteMap,
int BBLastPtr,
boolean replacemap)
public void recordJSRSubroutineMap(int byteindex,
byte[] currReferenceMap,
int BBLastPtr,
int returnAddrIndex,
boolean replacemap)
byteindex - index into the byte code array of the point for the mapcurrReferenceMap - map of references and return addresses that were set
within the JSR SubroutineBBLastPtr - map runs from -1 to BBLastPtr inclusivelyreturnAddrIndex - Index in the stack where the return address
for the jsr routine (in which this gcpoint is located)
can be foundreplacemap - False if this is the first time this map point has been
recorded.private int addUnusualMap(UnusualMaps jsrSiteMap)
jsrSiteMap - unusualMap to be added to arraypublic int setupJSRSubroutineMap(int mapid)
locateGCPoint(org.vmmagic.unboxed.Offset, org.jikesrvm.classloader.RVMMethod). This routine
searches the map tables and uses its stack frameAddress input to build
reference and returnAddress maps. The caller uses the getNext...
routines to scan these maps for offsets in the frame of the
related references.
mapid - Index of map of instruction where map is required
( this value was returned by locateGCpoint)
steps for this routine
use the mapid to get index of the Unusual Map
from the unusual map and the frame - get the location of the jsr invoker
from the invoker address and the code base address - get the machine code offset
from the machine code offset locate the map for that instruction
if the invoker was itself in a jsr- merge the delta maps of each jsr and
compute the new total delta maps
else the invoker was not already in a jsr merge the unusual map differences
with the invoker map
public int getNextJSRAddressIndex(Offset nextMachineCodeOffset,
NormalMethod m)
public void recordingComplete()
public void translateByte2Machine(int[] b2m)
private byte convertMapElement(byte[] curBBMap,
int offset,
int len,
byte reftype)
private int getNextMapElement()
private int scanForNextRef(int bitnum,
int wordnum,
int remaining,
byte[] map)
private int scanByte(int bitnum,
int bytenum,
int toscan,
byte[] map)
int scanByteArray(byte[] byteMap,
int BBLastPtr,
byte refType,
int mapslot,
boolean skipOneBit)
private void unusualMapcopy(UnusualMaps from)
private void copyBitMap(int extramapindex,
int index)
private UnusualMaps combineDeltaMaps(int jsrUnusualMapid)
private void mergeMap(int targetindex,
int deltaindex,
ReferenceMaps.MergeOperation Op)
private void finalMergeMaps(int jsrBaseMapIndex,
UnusualMaps deltaMap)
The nested jsr subroutine maps were merged into a single delta map prior to the calling of this method. We therefore know that the base map can never be due to a subroutine (since all subroutines have been merged), and therefore that there are no return address maps due to the invoker (since return addresses are only due to the subroutine maps).
jsrBaseMapIndex - The map index for the invokerdeltaMap - The map for the invoked subroutine/s (all nested
subroutine maps are guaranteed to have been combined prior to
calling this)public void cleanupPointers()
int findUnusualMap(int mapid)
public void showInfo()
public void showAMap(int MCSiteIndex)
public void showOffsets()
public int showReferenceMapStatistics(RVMMethod method)
public boolean isLocalRefType(RVMMethod method,
Offset mcoff,
int lidx)
method - The method we're asking about.mcoff - The machine code offset of the instruction *following* the
actual instruction.lidx - the local index
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||