proguard.classfile.instruction
Class VariableInstruction

java.lang.Object
  extended by proguard.classfile.instruction.Instruction
      extended by proguard.classfile.instruction.VariableInstruction

public class VariableInstruction
extends Instruction

This Instruction represents an instruction that refers to a variable on the local variable stack.


Field Summary
 int constant
           
 int variableIndex
           
 boolean wide
           
 
Fields inherited from class proguard.classfile.instruction.Instruction
opcode
 
Constructor Summary
VariableInstruction()
          Creates an uninitialized VariableInstruction.
VariableInstruction(boolean wide)
           
VariableInstruction(byte opcode)
           
VariableInstruction(byte opcode, int variableIndex)
           
VariableInstruction(byte opcode, int variableIndex, int constant)
           
 
Method Summary
 void accept(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, InstructionVisitor instructionVisitor)
          Accepts the given visitor.
 byte canonicalOpcode()
          Returns the canonical opcode of this instruction, i.e.
 VariableInstruction copy(VariableInstruction variableInstruction)
          Copies the given instruction into this instruction.
 boolean isLoad()
          Returns whether this instruction loads the value of a variable.
 boolean isStore()
          Returns whether this instruction stores the value of a variable.
protected  boolean isWide()
          Returns whether the instruction is wide, i.e.
 int length(int offset)
          Returns the length in bytes of the instruction.
protected  void readInfo(byte[] code, int offset)
          Reads the data following the instruction opcode.
 Instruction shrink()
          Shrinks this instruction to its shortest possible form.
 java.lang.String toString()
           
protected  void writeInfo(byte[] code, int offset)
          Writes data following the instruction opcode.
 
Methods inherited from class proguard.classfile.instruction.Instruction
getName, isCategory2, readByte, readInt, readShort, readSignedByte, readSignedShort, readSignedValue, readValue, stackPopCount, stackPushCount, toString, write, write, writeByte, writeInt, writeShort, writeSignedByte, writeSignedShort, writeSignedValue, writeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wide

public boolean wide

variableIndex

public int variableIndex

constant

public int constant
Constructor Detail

VariableInstruction

public VariableInstruction()
Creates an uninitialized VariableInstruction.


VariableInstruction

public VariableInstruction(boolean wide)

VariableInstruction

public VariableInstruction(byte opcode)

VariableInstruction

public VariableInstruction(byte opcode,
                           int variableIndex)

VariableInstruction

public VariableInstruction(byte opcode,
                           int variableIndex,
                           int constant)
Method Detail

copy

public VariableInstruction copy(VariableInstruction variableInstruction)
Copies the given instruction into this instruction.

Parameters:
variableInstruction - the instruction to be copied.
Returns:
this instruction.

isStore

public boolean isStore()
Returns whether this instruction stores the value of a variable. The value is false for the ret instruction, but true for the iinc instruction.


isLoad

public boolean isLoad()
Returns whether this instruction loads the value of a variable. The value is true for the ret instruction and for the iinc instruction.


canonicalOpcode

public byte canonicalOpcode()
Description copied from class: Instruction
Returns the canonical opcode of this instruction, i.e. typically the opcode whose extension has been removed.

Overrides:
canonicalOpcode in class Instruction

shrink

public Instruction shrink()
Description copied from class: Instruction
Shrinks this instruction to its shortest possible form.

Specified by:
shrink in class Instruction
Returns:
this instruction.

isWide

protected boolean isWide()
Description copied from class: Instruction
Returns whether the instruction is wide, i.e. preceded by a wide opcode. With the current specifications, only variable instructions can be wide.

Overrides:
isWide in class Instruction

readInfo

protected void readInfo(byte[] code,
                        int offset)
Description copied from class: Instruction
Reads the data following the instruction opcode.

Specified by:
readInfo in class Instruction

writeInfo

protected void writeInfo(byte[] code,
                         int offset)
Description copied from class: Instruction
Writes data following the instruction opcode.

Specified by:
writeInfo in class Instruction

length

public int length(int offset)
Description copied from class: Instruction
Returns the length in bytes of the instruction.

Specified by:
length in class Instruction

accept

public void accept(Clazz clazz,
                   Method method,
                   CodeAttribute codeAttribute,
                   int offset,
                   InstructionVisitor instructionVisitor)
Description copied from class: Instruction
Accepts the given visitor.

Specified by:
accept in class Instruction

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object