|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.wala.shrikeBT.Instruction
public abstract class Instruction
Instructions are immutable objects. It is always legal to take a reference to an instruction and use it in any other context. You never need to copy instructions. It is often a good idea to keep references to frequently used instructions cached in static fields. To generate an Instruction, locate the class for the instruction you want to generate, and invoke the appropriate "make" static method on that class. The Util class has convenience methods for creating some of the more complex instructions using reflection to fill in some of the needed information (e.g., makeGet, makePut, makeInvoke). We simplify the bytecode instruction set a bit using some preprocessing and postprocessing: There is no 'iinc' instruction. 'iinc' instructions are expanded to 'iload; bipush; iadd; istore' during decoding and reassembled during compilation. There are no 'jsr' or 'ret' instructions. Bytecode subroutines are expanded inline during decoding. There are no 'ifeq', 'ifne', 'ifgt', 'ifge', 'iflt', 'ifle' instructions. These instructions are expanded to 'bipush 0; if_icmp' during decoding and reassembled during compilation. There are no 'ifnull' or 'ifnonnull' instructions. These instructions are expanded to 'aconst_null; if_acmp' during decoding and reassembled during compilation. All Java values, including longs and doubles, occupy just one word on the stack. Places where the JVM assumes differently are fixed up during compilation. However, longs and double still take up two local variable slots (this usually doesn't matter to instrumentation). Control transfer instructions refer to target instructions using integers. These integers are usually indices into an array of instructions.
| Nested Class Summary | |
|---|---|
static class |
Instruction.Visitor
This class is used by Instruction.visit to dispatch based on the instruction type. |
| Field Summary |
|---|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
We're immutable so there's no need to clone any Instruction object. |
int[] |
getBranchTargets()
|
short |
getOpcode()
|
int |
getPoppedCount()
|
java.lang.String |
getPushedType(java.lang.String[] poppedTypesToCheck)
Computes the type of data pushed onto the stack, or null if none is pushed. |
byte |
getPushedWordSize()
|
boolean |
isFallThrough()
|
Instruction |
redirectTargets(int[] targetMap)
|
abstract java.lang.String |
toString()
Subclasses must implement toString. |
abstract void |
visit(Instruction.Visitor v)
Apply a Visitor to this instruction. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.ibm.wala.shrikeBT.IInstruction |
|---|
isPEI |
| Method Detail |
|---|
public boolean isFallThrough()
public int[] getBranchTargets()
public Instruction redirectTargets(int[] targetMap)
public int getPoppedCount()
public final short getOpcode()
public java.lang.String getPushedType(java.lang.String[] poppedTypesToCheck)
poppedTypesToCheck - the types of the data popped off the stack by this instruction; if
poppedTypes is null, then we don't know the incoming stack types
and the result of this method may be less accuratepublic byte getPushedWordSize()
public abstract void visit(Instruction.Visitor v)
public abstract java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||