TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class LoadInstruction

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.Instruction
        |
        +--com.techtrader.modules.tools.bytecode.LocalVariableInstruction
              |
              +--com.techtrader.modules.tools.bytecode.TypedLocalVariableInstruction
                    |
                    +--com.techtrader.modules.tools.bytecode.LoadInstruction

public class LoadInstruction
extends TypedLocalVariableInstruction

Represents an instruction to load a value from a local variable onto the stack; can be any of aload_*, iload_*, etc.

Author:
Abe White

Fields inherited from class com.techtrader.modules.tools.bytecode.TypedLocalVariableInstruction
_type, _typeNames
 
Fields inherited from class com.techtrader.modules.tools.bytecode.LocalVariableInstruction
_index
 
Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction
_byteIndex, _opcode, _opcodeTypes, _owner
 
Constructor Summary
protected LoadInstruction(Code owner)
           
protected LoadInstruction(Code owner, int opcode, Class type, int index)
           
 
Method Summary
 void acceptVisit(BCVisitor visit)
          Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object.
protected  void calculateOpCode()
          Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.
 boolean equals(Object other)
          Two local variable instructions are equal if the local index they reference is equal and their types are equal, or if either index is 0/unset.
 int getLength()
          Return the length in bytes of this opcode, including all arguments.
 int getStackChange()
          Return the number of stack positions this instruction pushes or pops during its execution.
protected  void readData(DataInput in)
          Read the arguments for this opcode from the given stream.
protected  void writeData(DataOutput out)
          Write the arguments for this opcode to the given stream.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.TypedLocalVariableInstruction
copy, getType, getTypeName, setType, setTypeName
 
Methods inherited from class com.techtrader.modules.tools.bytecode.LocalVariableInstruction
getIndex, setIndex
 
Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction
getByteIndex, getName, getOpCode, getOwner, invalidate, setByteIndex, setOpCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadInstruction

protected LoadInstruction(Code owner)

LoadInstruction

protected LoadInstruction(Code owner,
                          int opcode,
                          Class type,
                          int index)
Method Detail

equals

public boolean equals(Object other)
Description copied from class: TypedLocalVariableInstruction
Two local variable instructions are equal if the local index they reference is equal and their types are equal, or if either index is 0/unset.
Overrides:
equals in class TypedLocalVariableInstruction

getLength

public int getLength()
Description copied from class: Instruction
Return the length in bytes of this opcode, including all arguments. This method should be overridden by opcodes that take arguments.
Overrides:
getLength in class Instruction

getStackChange

public int getStackChange()
Description copied from class: Instruction
Return the number of stack positions this instruction pushes or pops during its execution.
Overrides:
getStackChange in class Instruction
Tags copied from class: Instruction
Returns:
0 if the stack is not affected by this instruction, a positive number if it pushes onto the stack, and a negative number if it pops from the stack

readData

protected void readData(DataInput in)
                 throws IOException
Description copied from class: Instruction
Read the arguments for this opcode from the given stream. This method should be overridden by opcodes that take arguments.
Overrides:
readData in class Instruction

writeData

protected void writeData(DataOutput out)
                  throws IOException
Description copied from class: Instruction
Write the arguments for this opcode to the given stream. This method should be overridden by opcodes that take arguments.
Overrides:
writeData in class Instruction

calculateOpCode

protected void calculateOpCode()
Description copied from class: LocalVariableInstruction
Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.
Overrides:
calculateOpCode in class LocalVariableInstruction

acceptVisit

public void acceptVisit(BCVisitor visit)
Description copied from interface: VisitAcceptor
Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object.
Overrides:
acceptVisit in class Instruction

TechTrader Bytecode Toolkit