public final class EncodedOSRMap extends Object
In OptCompiledMethod, an instance of this class will represent all OSR map info for that method.
Modifier and Type | Field and Description |
---|---|
private static EncodedOSRMap |
emptyMap
map used when there are no OSR instructions
|
private int |
lastEntry
the last entry index.
|
private long[] |
mapEntries
osr info entries
|
private int[] |
osrMaps
the OSR map
|
Modifier | Constructor and Description |
---|---|
private |
EncodedOSRMap()
Constructor to build empty map
|
private |
EncodedOSRMap(VariableMap varMap,
MachineCodeOffsets mcOffsets) |
Modifier and Type | Method and Description |
---|---|
private void |
_generateMapForOneMethodVariable(ArrayList<Integer> tempOsrMaps,
int regMapIndex,
MethodVariables mVar,
boolean lastMid)
Generate value in the Osr map
|
private int |
findOSREntry(Offset mcOffset)
Do a binary search, find the entry for the machine code offset.
|
private int |
generateOsrMaps(ArrayList<Integer> tempOsrMaps,
LinkedList<MethodVariables> mVarList)
Generate value in the Osr map,
return the index of the first integer in the map.
|
private int |
getBCIndex(int entry) |
int |
getBytecodeIndexForMCOffset(Offset mcOffset)
Get bytecode index for a given instruction offset in bytes.
|
private int |
getIEIndex(int entry) |
int |
getInlineEncodingForMCOffset(Offset mcOffset) |
int[] |
getMCIndexes() |
private int |
getMCOffset(int entry) |
private int |
getOSRMapIndex(int entry) |
OSRMapIterator |
getOsrMapIteratorForMCOffset(Offset mcOffset)
given a MC offset, return an iterator over the
elements of this map.
|
private static int |
getRegBitPosition(int regnum) |
int |
getRegisterMapForMCOffset(Offset mcOffset)
Gets register's reference map for the machine instruction offset
|
boolean |
hasOSRMap(Offset mcOffset) |
static EncodedOSRMap |
makeMap(VariableMap varMap,
MachineCodeOffsets mcOffsets)
Encodes the given variable map as OSRMap.
|
void |
printMap()
print the encoded map for debugging.
|
private void |
processTuple(ArrayList<Integer> tempOsrMaps,
LocalRegPair tuple,
boolean isLast)
Process a 32-bit tuple.
|
static boolean |
registerIsSet(int map,
int regnum) |
private void |
setBCIndex(int entry,
int index) |
private void |
setIEIndex(int entry,
int index) |
private void |
setMCOffset(int entry,
int offset) |
private void |
setOSRMapIndex(int entry,
int index) |
private static int |
setRegister(int map,
int regnum)
Marks a register as a reference type.
|
private void |
translateMap(ArrayList<Integer> tempOsrMaps,
LinkedList<VariableMapElement> osrlist,
MachineCodeOffsets mcOffsets)
Translates a list of OSR_MapElement to encoding.
|
private final long[] mapEntries
private final int lastEntry
private final int[] osrMaps
private static final EncodedOSRMap emptyMap
private EncodedOSRMap()
private EncodedOSRMap(VariableMap varMap, MachineCodeOffsets mcOffsets)
varMap
- the variable map to use for building
the EncodedOSRMapmcOffsets
- the machine code offsets for the
instructionspublic static boolean registerIsSet(int map, int regnum)
private static int setRegister(int map, int regnum)
map
- the mapregnum
- the register's numberprivate static int getRegBitPosition(int regnum)
public static EncodedOSRMap makeMap(VariableMap varMap, MachineCodeOffsets mcOffsets)
varMap
- the variable map to encodemcOffsets
- machine code offsets for the instructionsprivate void translateMap(ArrayList<Integer> tempOsrMaps, LinkedList<VariableMapElement> osrlist, MachineCodeOffsets mcOffsets)
we can not trust the osrlist is in the increasing order of machine code offset. Sort it first.
tempOsrMaps
- an empty list that will hold temporary
OSR map informationosrlist
- information about instructions and variablesmcOffsets
- machine code offsets for the
instructionsprivate int generateOsrMaps(ArrayList<Integer> tempOsrMaps, LinkedList<MethodVariables> mVarList)
An OSR Map has following structure:
| regmap || mid, mpc, (n1, n2) ... || || mid, mpc, (n1, n2) ... ||Regmap indicates the value of which register is a reference, the execution state extractor can convert the value to an object to avoid confusing GC. The MSB of regmap indicates next mid is valid.
The MSB of mid indicates if the next mid item will be available.
The MSB of mpc indicates if the next is a valid pair
tempOsrMaps
- temporary OSR map information. This method will
fill this data structure.mVarList
- information about variablesprivate void _generateMapForOneMethodVariable(ArrayList<Integer> tempOsrMaps, int regMapIndex, MethodVariables mVar, boolean lastMid)
tempOsrMaps
- the maps under constructionregMapIndex
- used to patch the register mapmVar
- the method variableslastMid
- whether this is the last method in the inlined chainprivate void processTuple(ArrayList<Integer> tempOsrMaps, LocalRegPair tuple, boolean isLast)
tempOsrMaps
- the temporary osr mapstuple
- mapping of the local to registerisLast
- whether to set OSRConstants.NEXT_BIT
public boolean hasOSRMap(Offset mcOffset)
mcOffset
- the machine instruction offsetpublic int getBytecodeIndexForMCOffset(Offset mcOffset)
NOTE: It is the caller's reponsibility to make sure there are OSR entry exist for a machine instruction offset.
mcOffset
- the instruction offset in bytespublic int getInlineEncodingForMCOffset(Offset mcOffset)
public int getRegisterMapForMCOffset(Offset mcOffset)
mcOffset
- the instruction offset in bytespublic OSRMapIterator getOsrMapIteratorForMCOffset(Offset mcOffset)
NOTE: the map index is gotten from 'findOSRMapIndex'. This has to be changed....
mcOffset
- the instruction offset in bytesprivate int findOSREntry(Offset mcOffset)
mcOffset
- the instruction offset in bytesOSRConstants.NO_OSR_ENTRY
if no entry was found, the
entry otherwiseprivate int getMCOffset(int entry)
private int getOSRMapIndex(int entry)
private int getBCIndex(int entry)
private int getIEIndex(int entry)
private void setMCOffset(int entry, int offset)
private void setOSRMapIndex(int entry, int index)
private void setBCIndex(int entry, int index)
private void setIEIndex(int entry, int index)
public void printMap()
public int[] getMCIndexes()