Package jminusminus
Class CLInstruction
java.lang.Object
jminusminus.CLInstruction
- Direct Known Subclasses:
- CLArithmeticInstruction,- CLArrayInstruction,- CLBitInstruction,- CLComparisonInstruction,- CLConversionInstruction,- CLFieldInstruction,- CLFlowControlInstruction,- CLLoadStoreInstruction,- CLMethodInstruction,- CLMiscInstruction,- CLObjectInstruction,- CLStackInstruction
Representation of a JVM instruction. It stores the opcode and mnenomic of an instruction, its
 operand count (DYNAMIC if the instruction has variable number operands), pc (location counter),
 stack units (words produced - words consumed from the operand stack), and local variable index
 (IRRELEVANT if the instruction does not operate on local variables).
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final CLInsInfo[]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 intIndex of the local variable that this instruction refers to; applies only to instructions that operate on local variables.protected StringMnemonic for this instruction.protected intOpcode for this instruction.protected intNumber of operands for this instruction; determined statically for all instructions except TABLESWITCH and LOOKUPSWITCH.protected intLocation counter; index of this instruction within the code array of a method.protected intStack units; words produced - words consumed from the operand stack by this instruction.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected intbyteAt(int i, int byteNum) Returns the byte from i at position byteNum.static booleanisValid(int opcode) Returns true if the opcode is valid, and false otherwise.intReturns the local variable index for this instruction.mnemonic()Returns the mnemonic for this instruction.intopcode()Returns the opcode for this instruction.intReturns the number of operands for this instruction.intpc()Returns the pc for this instruction.intReturns the stack units for this instruction.toBytes()Returns the bytecode for this instruction.
- 
Field Details- 
opcodeprotected int opcodeOpcode for this instruction.
- 
mnemonicMnemonic for this instruction.
- 
operandCountprotected int operandCountNumber of operands for this instruction; determined statically for all instructions except TABLESWITCH and LOOKUPSWITCH.
- 
pcprotected int pcLocation counter; index of this instruction within the code array of a method.
- 
stackUnitsprotected int stackUnitsStack units; words produced - words consumed from the operand stack by this instruction.
- 
localVariableIndexprotected int localVariableIndexIndex of the local variable that this instruction refers to; applies only to instructions that operate on local variables.
- 
instructionInfoFor 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. For example, for IMUL, these parameters are IMUL, "imul", 0, IRRELEVANT, -1, ARITHMETIC1.
 
- 
- 
Constructor Details- 
CLInstructionCLInstruction()
 
- 
- 
Method Details- 
isValidpublic static boolean isValid(int opcode) Returns true if the opcode is valid, and false otherwise.- Parameters:
- opcode- instruction opcode.
- Returns:
- true if the opcode is valid, and false otherwise.
 
- 
opcodepublic int opcode()Returns the opcode for this instruction.- Returns:
- the opcode for this instruction.
 
- 
mnemonicReturns the mnemonic for this instruction.- Returns:
- the mnemonic for this instruction.
 
- 
operandCountpublic int operandCount()Returns the number of operands for this instruction.- Returns:
- the number of operands for this instruction.
 
- 
pcpublic int pc()Returns the pc for this instruction.- Returns:
- the pc for this instruction.
 
- 
stackUnitspublic int stackUnits()Returns the stack units for this instruction.- Returns:
- the stack units for this instruction.
 
- 
localVariableIndexpublic int localVariableIndex()Returns the local variable index for this instruction.- Returns:
- the local variable index for this instruction.
 
- 
toBytesReturns the bytecode for this instruction.- Returns:
- the bytecode for this instruction.
 
- 
byteAtprotected int byteAt(int i, int byteNum) Returns the byte from i at position byteNum.- Parameters:
- i- number whose individual byte is required.
- byteNum- the byte to return (1: lower - 4: higher).
- Returns:
- the byte at the specified position.
 
 
-