|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.osr.BytecodeTraverser
public class BytecodeTraverser
BytecodeTraverser does depth first search on a bytecode array, determines the type information of locals and stacks at Interesting point.
This class only intends to provide type information for on-stack replacement, which needs to know the type of a value. This class can only tells basic type information such as : REFERENCE, LONG, DOUBLE, FLOAT, INT, and ReturnAddress. Not like GCMap which tells GC a value is REFERENCE or NON-REFERENCE we also want to know it is INT or DOUBLE, and takes two words value or one word.
The produced type information has to be adjusted by consulting GC maps because two different types may merge at one program point (REF and non-REF types). Bytecode verifier will make the type info undefined in that case. But this class won't know. So the caller should check the GC map to validate a REF type variable.
More or less, this class needs to do the same work as a bytecode verifier, which tells the type and size of each locals and stacks. The JSR/RET instructions pose the difficulty to our case. However, we can assume the bytecode is verified. We use following assumptions:
| Field Summary | |
|---|---|
private int |
addr
|
private BytecodeStream |
bytecodes
|
private boolean |
ignoreGotos
|
private byte[] |
ltypes
|
private int[] |
retaddr
|
private byte[] |
stypes
|
private boolean |
TRACE
|
private byte[] |
visitedpc
|
| Fields inherited from interface org.jikesrvm.osr.OSRConstants |
|---|
ACONST, BCI_MASK, BCI_SHIFT, CLEANREFS, DOUBLE, FLOAT, GETREFAT, HIGH_64BIT, ICONST, IEI_MASK, IEI_SHIFT, INT, INVALID_BCI, INVALID_IEI, KIND_MASK, KIND_SHIFT, LCONST, LOCAL, LONG, NEXT_BIT, NO_OSR_ENTRY, NUM_MASK, NUM_SHIFT, OFFSET_MASK, OFFSET_SHIFT, OSRI_MASK, OSRI_SHIFT, PHYREG, PSEUDO_CheckCast, PSEUDO_InvokeCompiledMethod, PSEUDO_InvokeStatic, PSEUDO_LoadDoubleConst, PSEUDO_LoadFloatConst, PSEUDO_LoadIntConst, PSEUDO_LoadLongConst, PSEUDO_LoadRetAddrConst, PSEUDO_LoadWordConst, PSEUDO_ParamInitEnd, REF, RET_ADDR, ReturnAddressTypeCode, SPILL, STACK, TCODE_MASK, TCODE_SHIFT, VTYPE_MASK, VTYPE_SHIFT, WORD, WordTypeCode |
| Constructor Summary | |
|---|---|
BytecodeTraverser()
|
|
| Method Summary | |
|---|---|
boolean |
computeLocalStackTypes(NormalMethod method,
int bcpoint)
Computes types of local variable and stack slots at an interesting point for future querying. |
void |
computeStackHeights(NormalMethod method,
BytecodeStream bcodes,
int[] stackHeights,
boolean adjustExptable)
|
byte[] |
getLocalTypes()
Returns an array of type information of locals at the registered program point. |
private byte |
getReturnCodeFromSignature(String sig)
|
byte[] |
getStackTypes()
Returns an array of type information of stacks at a program point. |
void |
prologueStackHeights(NormalMethod method,
BytecodeStream bcodes,
int[] stackHeights)
Compute stack heights of bytecode stream (used for osr prologue) |
private boolean |
scanBlocks(NormalMethod method,
BytecodeStream bytecodes,
boolean doDFS,
int pcs,
byte[] ltypes,
byte[] stypes,
int startpc,
TypeStack S,
int[] stackHeights)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int[] retaddr
private int addr
private byte[] visitedpc
private boolean TRACE
private boolean ignoreGotos
private BytecodeStream bytecodes
private byte[] ltypes
private byte[] stypes
| Constructor Detail |
|---|
public BytecodeTraverser()
| Method Detail |
|---|
public boolean computeLocalStackTypes(NormalMethod method,
int bcpoint)
method - whose bytecode to be queriedbcpoint - the bytecode index which is the interesting point
at the mean time, we only support one PC.
public byte[] getLocalTypes()
public byte[] getStackTypes()
public void computeStackHeights(NormalMethod method,
BytecodeStream bcodes,
int[] stackHeights,
boolean adjustExptable)
public void prologueStackHeights(NormalMethod method,
BytecodeStream bcodes,
int[] stackHeights)
private byte getReturnCodeFromSignature(String sig)
private boolean scanBlocks(NormalMethod method,
BytecodeStream bytecodes,
boolean doDFS,
int pcs,
byte[] ltypes,
byte[] stypes,
int startpc,
TypeStack S,
int[] stackHeights)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||