java.io.Serializable, java.lang.CloneableACONST_NULL, ArithmeticInstruction, ArrayInstruction, ARRAYLENGTH, ATHROW, BIPUSH, BranchInstruction, BREAKPOINT, ConversionInstruction, CPInstruction, DCMPG, DCMPL, DCONST, FCMPG, FCMPL, FCONST, ICONST, IMPDEP1, IMPDEP2, LCMP, LCONST, LocalVariableInstruction, MONITORENTER, MONITOREXIT, NEWARRAY, NOP, RET, ReturnInstruction, SIPUSH, StackInstructionpublic abstract class Instruction
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
| Modifier and Type | Field | Description |
|---|---|---|
protected short |
length |
|
protected short |
opcode |
| Constructor | Description |
|---|---|
Instruction(short opcode,
short length) |
| Modifier and Type | Method | Description |
|---|---|---|
abstract void |
accept(Visitor v) |
Call corresponding visitor method(s).
|
int |
consumeStack(ConstantPoolGen cpg) |
This method also gives right results for instructions whose
effect on the stack depends on the constant pool entry they
reference.
|
Instruction |
copy() |
Use with caution, since `BranchInstruction's have a `target' reference which
is not copied correctly (only basic types are).
|
void |
dump(java.io.DataOutputStream out) |
Dump instruction as byte code to stream out.
|
boolean |
equals(java.lang.Object that) |
Check for equality, delegated to comparator
|
static InstructionComparator |
getComparator() |
Get Comparator object used in the equals() method to determine
equality of instructions.
|
int |
getLength() |
|
java.lang.String |
getName() |
|
short |
getOpcode() |
|
protected void |
initFromFile(ByteSequence bytes,
boolean wide) |
Read needed data (e.g.
|
int |
produceStack(ConstantPoolGen cpg) |
This method also gives right results for instructions whose
effect on the stack depends on the constant pool entry they
reference.
|
static Instruction |
readInstruction(ByteSequence bytes) |
Read an instruction from (byte code) input stream and return the
appropiate object.
|
static void |
setComparator(InstructionComparator c) |
Set comparator to be used for equals().
|
java.lang.String |
toString() |
|
java.lang.String |
toString(boolean verbose) |
Long output format:
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
|
java.lang.String |
toString(ConstantPool cp) |
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
out - Output streamjava.io.IOExceptionpublic java.lang.String getName()
public java.lang.String toString(boolean verbose)
verbose - long/short format switchpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(ConstantPool cp)
public Instruction copy()
BranchInstructionprotected void initFromFile(ByteSequence bytes, boolean wide) throws java.io.IOException
bytes - byte sequence to read fromwide - "wide" instruction flagjava.io.IOExceptionpublic static final Instruction readInstruction(ByteSequence bytes) throws java.io.IOException
bytes - input stream bytesjava.io.IOExceptionpublic int consumeStack(ConstantPoolGen cpg)
public int produceStack(ConstantPoolGen cpg)
public short getOpcode()
public int getLength()
public abstract void accept(Visitor v)
v - Visitor objectpublic static InstructionComparator getComparator()
public static void setComparator(InstructionComparator c)
public boolean equals(java.lang.Object that)
equals in class java.lang.Object