TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class LocalVariableInstruction

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.Instruction
        |
        +--com.techtrader.modules.tools.bytecode.LocalVariableInstruction
Direct Known Subclasses:
IIncInstruction, RetInstruction, TypedLocalVariableInstruction

public abstract class LocalVariableInstruction
extends Instruction

Represents an instruction that has an argument of an index into the local variable array of the current frame. This includes most of the LOAD and STORE instructions.

The local variable array size is fixed by the 'maxLocals' property of the code block. Long and double types take up 2 local variable indexes.

Parameter values to methods are loaded into the local variable array prior to the execution of the first instruction. The 0th-index of the array is set to the instance of the class the method is being invoked on.

Author:
Abe White

Field Summary
protected  int _index
           
 
Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction
_byteIndex, _opcode, _opcodeTypes, _owner
 
Constructor Summary
protected LocalVariableInstruction(Code owner)
           
 
Method Summary
protected  void calculateOpCode()
          Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.
protected  void copy(Instruction orig)
           
 boolean equals(Object other)
          Two local variable instructions are equal if the local index they reference is equal or if either index is 0/unset.
 int getIndex()
          Get the index of the local variable that this instruction should operate on.
 LocalVariableInstruction setIndex(int index)
          Set the index of the local variable that this instruction should operate on.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction
acceptVisit, getByteIndex, getLength, getName, getOpCode, getOwner, getStackChange, invalidate, readData, setByteIndex, setOpCode, writeData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_index

protected int _index
Constructor Detail

LocalVariableInstruction

protected LocalVariableInstruction(Code owner)
Method Detail

setIndex

public LocalVariableInstruction setIndex(int index)
Set the index of the local variable that this instruction should operate on.
Returns:
this Instruction, for method chaining

getIndex

public int getIndex()
Get the index of the local variable that this instruction should operate on.

equals

public boolean equals(Object other)
Two local variable instructions are equal if the local index they reference is equal or if either index is 0/unset.
Overrides:
equals in class Instruction

calculateOpCode

protected void calculateOpCode()
Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.

copy

protected void copy(Instruction orig)
Overrides:
copy in class Instruction

TechTrader Bytecode Toolkit