public class Instruction extends Object implements Cloneable
InstructionList
Modifier | Constructor and Description |
---|---|
protected |
Instruction(byte[] bytes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name)
Gets a named attribute.
|
Instruction |
getBranchParent()
Gets the branch instruction, that references this instruction as a target.
|
byte[] |
getBytes()
Gets the bytes of this instruction.
|
protected short |
getOffset()
Gets the offset of this instruction.
|
byte |
getOpcode()
Gets the opcode of this Instruction.
|
boolean |
isBranchTarget()
return whether or not this Instruction is a target of a branch.
|
int |
length()
Get the length of this instruction.
|
void |
setAttribute(String name)
Sets a named attribute to this Instruction.
|
void |
setAttribute(String name,
Object value)
Sets a named attribute to this Instruction.
|
protected void |
setBytes(byte[] bytes)
Set the bytes of this Instruction.
|
protected void |
setOffset(short offset)
Sets the offset of this instruction.
|
short |
stackConsumption()
Get the stack consumption of this Instruction.
|
short |
stackUsage()
Get the stack usage this Instruction uses.
|
String |
toString() |
protected Instruction(byte[] bytes)
bytes
- Byte array representing this instruction. May not be null.
Bytes must have at least one byte in it.IllegalArgumentException
- is thrown, if byte[].length == 0protected void setBytes(byte[] bytes)
bytes
- Byte arraypublic byte[] getBytes()
public byte getOpcode()
public int length()
getBytes().length
public short stackUsage()
Some instructions may both consume and produce data on stack. This method returns the total usage after instruction has been executed.
public short stackConsumption()
protected void setOffset(short offset)
offset
- Offset to setprotected short getOffset()
public void setAttribute(String name)
name
- Name of the attributepublic void setAttribute(String name, Object value)
name
- Name of the attributevalue
- valuepublic Object getAttribute(String name)
name
- Name of the attributepublic boolean isBranchTarget()
public Instruction getBranchParent()
Copyright © 2017. All rights reserved.