joeq.Compiler.BytecodeAnalysis
Class Bytecodes.LocalVariableInstruction

java.lang.Object
  extended by joeq.Compiler.BytecodeAnalysis.Bytecodes.Instruction
      extended by joeq.Compiler.BytecodeAnalysis.Bytecodes.LocalVariableInstruction
All Implemented Interfaces:
Serializable, Cloneable, Bytecodes.IndexedInstruction, Bytecodes.TypedInstruction
Direct Known Subclasses:
Bytecodes.IINC, Bytecodes.LoadInstruction, Bytecodes.StoreInstruction
Enclosing interface:
Bytecodes

public abstract static class Bytecodes.LocalVariableInstruction
extends Bytecodes.Instruction
implements Bytecodes.TypedInstruction, Bytecodes.IndexedInstruction

See Also:
Serialized Form

Field Summary
protected  int n
           
 
Fields inherited from class joeq.Compiler.BytecodeAnalysis.Bytecodes.Instruction
length, opcode
 
Constructor Summary
protected Bytecodes.LocalVariableInstruction(short opcode, short c_tag, int n)
           
 
Method Summary
 void dump(DataOutputStream out)
          Dump instruction as byte code to stream out.
 short getCanonicalTag()
           
 int getIndex()
           
 jq_Type getType()
          Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned.
protected  void initFromFile(jq_ConstantPool cp, jwutil.io.ByteSequence bytes, boolean wide)
          Read needed data (e.g.
 void setIndex(int n)
          Set the local variable index
 String toString(boolean verbose)
          Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"
 
Methods inherited from class joeq.Compiler.BytecodeAnalysis.Bytecodes.Instruction
accept, consumeStack, copy, getLength, getOpcode, produceStack, readInstruction, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n

protected int n
Constructor Detail

Bytecodes.LocalVariableInstruction

protected Bytecodes.LocalVariableInstruction(short opcode,
                                             short c_tag,
                                             int n)
Parameters:
opcode - Instruction opcode
c_tag - Instruction number for compact version, ALOAD_0, e.g.
n - local variable index (unsigned short)
Method Detail

dump

public void dump(DataOutputStream out)
          throws IOException
Dump instruction as byte code to stream out.

Overrides:
dump in class Bytecodes.Instruction
Parameters:
out - Output stream
Throws:
IOException

toString

public String toString(boolean verbose)
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"

Overrides:
toString in class Bytecodes.Instruction
Parameters:
verbose - long/short format switch
Returns:
mnemonic for instruction

initFromFile

protected void initFromFile(jq_ConstantPool cp,
                            jwutil.io.ByteSequence bytes,
                            boolean wide)
                     throws IOException
Read needed data (e.g. index) from file. PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)

Overrides:
initFromFile in class Bytecodes.Instruction
Parameters:
cp - constant pool of class we are reading
bytes - byte sequence to read from
wide - "wide" instruction flag
Throws:
IOException

getIndex

public final int getIndex()
Specified by:
getIndex in interface Bytecodes.IndexedInstruction
Returns:
local variable index referred by this instruction.

setIndex

public void setIndex(int n)
Set the local variable index

Specified by:
setIndex in interface Bytecodes.IndexedInstruction

getCanonicalTag

public short getCanonicalTag()
Returns:
canonical tag for instruction, e.g., ALOAD for ALOAD_0

getType

public final jq_Type getType()
Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned. This is just a bit incorrect, because ALOAD and ASTORE may work on every ReferenceType (including Type.NULL) and ASTORE may even work on a ReturnaddressType .

Specified by:
getType in interface Bytecodes.TypedInstruction
Returns:
type associated with the instruction


Copyright © 2001-2008 John Whaley. All Rights Reserved.