public abstract class Instruction extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected short |
length |
protected short |
opcode |
Constructor and Description |
---|
Instruction(short opcode,
short length) |
Modifier and Type | Method and 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(DataOutputStream out)
Dump instruction as byte code to stream out.
|
boolean |
equals(Object that)
Check for equality, delegated to comparator
|
static InstructionComparator |
getComparator()
Deprecated.
use the built in comparator, or wrap this class in another object that implements these methods
|
int |
getLength() |
String |
getName() |
short |
getOpcode() |
int |
hashCode()
calculate the hashCode of this object
|
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)
Deprecated.
use the built in comparator, or wrap this class in another object that implements these methods
|
String |
toString() |
String |
toString(boolean verbose)
Long output format:
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
|
String |
toString(ConstantPool cp) |
public void dump(DataOutputStream out) throws IOException
out
- Output streamIOException
public String getName()
public String toString(boolean verbose)
verbose
- long/short format switchpublic String toString()
public String toString(ConstantPool cp)
public Instruction copy()
BranchInstruction
protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
bytes
- byte sequence to read fromwide
- "wide" instruction flagIOException
- may be thrown if the implementation needs to read data from the filepublic static Instruction readInstruction(ByteSequence bytes) throws IOException
bytes
- input stream bytesIOException
public int consumeStack(ConstantPoolGen cpg)
public int produceStack(ConstantPoolGen cpg)
public short getOpcode()
public int getLength()
public abstract void accept(Visitor v)
v
- Visitor object@Deprecated public static InstructionComparator getComparator()
@Deprecated public static void setComparator(InstructionComparator c)
public boolean equals(Object that)
Copyright © 2017. All rights reserved.