Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.BytecodeAnalysis
Class Bytecodes.Instruction  view Bytecodes.Instruction download Bytecodes.Instruction.java

java.lang.Object
  extended byCompil3r.BytecodeAnalysis.Bytecodes.Instruction
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Bytecodes.ACONST_NULL, Bytecodes.ArithmeticInstruction, Bytecodes.ArrayInstruction, Bytecodes.ARRAYLENGTH, Bytecodes.ATHROW, Bytecodes.BIPUSH, Bytecodes.BranchInstruction, Bytecodes.BREAKPOINT, Bytecodes.ConversionInstruction, Bytecodes.CPInstruction, Bytecodes.DCMPG, Bytecodes.DCMPL, Bytecodes.DCONST, Bytecodes.FCMPG, Bytecodes.FCMPL, Bytecodes.FCONST, Bytecodes.ICONST, Bytecodes.LCMP, Bytecodes.LCONST, Bytecodes.LocalVariableInstruction, Bytecodes.MONITORENTER, Bytecodes.MONITOREXIT, Bytecodes.NEWARRAY, Bytecodes.NOP, Bytecodes.RET, Bytecodes.ReturnInstruction, Bytecodes.SIPUSH, Bytecodes.StackInstruction
Enclosing class:
Bytecodes

public abstract static class Bytecodes.Instruction
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable


Field Summary
protected  short length
           
protected  short opcode
           
 
Constructor Summary
(package private) Bytecodes.Instruction()
          Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
  Bytecodes.Instruction(short opcode, short length)
           
 
Method Summary
abstract  void accept(Bytecodes.Visitor v)
          Call corresponding visitor method(s).
private static java.lang.String className(short opcode)
           
 int consumeStack()
           
 Bytecodes.Instruction copy()
          Use with caution, since `BranchInstruction's have a `target' reference which is not copied correctly (only basic types are).
(package private)  void dispose()
          Some instructions may be reused, so don't do anything by default.
 void dump(java.io.DataOutputStream out)
          Dump instruction as byte code to stream out.
 int getLength()
           
 short getOpcode()
           
protected  void initFromFile(Clazz.jq_ConstantPool cp, Util.IO.ByteSequence bytes, boolean wide)
          Read needed data (e.g.
 int produceStack()
           
static Bytecodes.Instruction readInstruction(Clazz.jq_ConstantPool cp, Util.IO.ByteSequence bytes)
          Read an instruction from (byte code) input stream and return the appropiate object.
private  void setOpcode(short opcode)
          Needed in readInstruction.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 java.lang.String toString(boolean verbose)
          Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

protected short length

opcode

protected short opcode
Constructor Detail

Bytecodes.Instruction

Bytecodes.Instruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.


Bytecodes.Instruction

public Bytecodes.Instruction(short opcode,
                             short length)
Method Detail

dump

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


toString

public java.lang.String toString(boolean verbose)
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")"


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


copy

public Bytecodes.Instruction copy()
Use with caution, since `BranchInstruction's have a `target' reference which is not copied correctly (only basic types are). This also applies for `Select' instructions with their multiple branch targets.


initFromFile

protected void initFromFile(Clazz.jq_ConstantPool cp,
                            Util.IO.ByteSequence bytes,
                            boolean wide)
                     throws java.io.IOException
Read needed data (e.g. index) from file.


readInstruction

public static final Bytecodes.Instruction readInstruction(Clazz.jq_ConstantPool cp,
                                                          Util.IO.ByteSequence bytes)
                                                   throws java.io.IOException
Read an instruction from (byte code) input stream and return the appropiate object.


className

private static final java.lang.String className(short opcode)

consumeStack

public int consumeStack()

produceStack

public int produceStack()

getOpcode

public short getOpcode()

getLength

public int getLength()

setOpcode

private void setOpcode(short opcode)
Needed in readInstruction.


dispose

void dispose()
Some instructions may be reused, so don't do anything by default.


accept

public abstract void accept(Bytecodes.Visitor v)
Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.