abstract class CLInstruction extends Object
Modifier and Type | Field and Description |
---|---|
static CLInsInfo[] |
instructionInfo
For each JVM instruction, this array stores its opcode, mnemonic, number
of operands (DYNAMIC for instructions with variable attribute count),
local variable index (IRRELEVANT where not applicable), stack units, and
instruction category.
|
protected int |
localVariableIndex
Index of the local variable that this instruction refers to; applies only
to instructions that operate on local variables.
|
protected String |
mnemonic
Mnemonic for this instruction.
|
protected int |
opcode
Opcode for this instruction.
|
protected int |
operandCount
Number of operands for this instruction; determined statically for all
instructions except TABLESWITCH and LOOKUPSWITCH.
|
protected int |
pc
Location counter; index of this instruction within the code array of a
method.
|
protected int |
stackUnits
Stack units; words produced - words consumed from the operand stack by
this instruction.
|
Constructor and Description |
---|
CLInstruction() |
Modifier and Type | Method and Description |
---|---|
protected int |
byteAt(int i,
int byteNum)
Return the byte from i at position byteNum.
|
static boolean |
isValid(int opcode)
Return true if the opcode is valid; false otherwise.
|
int |
localVariableIndex()
Return the local variable index for this instruction.
|
String |
mnemonic()
Return the mnemonic for this instruction.
|
int |
opcode()
Return the opcode for this instruction.
|
int |
operandCount()
Return the number of operands for this instruction.
|
int |
pc()
Return the pc for this instruction.
|
int |
stackUnits()
Return the stack units for this instruction.
|
abstract ArrayList<Integer> |
toBytes()
Return the bytecode for this instruction.
|
protected int opcode
protected String mnemonic
protected int operandCount
protected int pc
protected int stackUnits
protected int localVariableIndex
public static final CLInsInfo[] instructionInfo
public static boolean isValid(int opcode)
opcode
- instruction opcode.public int opcode()
public String mnemonic()
public int operandCount()
public int pc()
public int stackUnits()
public int localVariableIndex()
public abstract ArrayList<Integer> toBytes()
protected int byteAt(int i, int byteNum)
i
- number whose individual byte is required.byteNum
- the byte to return; 1 (lower) - 4 (higher) instructions.