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

Quick Search    Search Deep

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

java.lang.Object
  extended byCompil3r.BytecodeAnalysis.Bytecodes.Instruction
      extended byCompil3r.BytecodeAnalysis.Bytecodes.BranchInstruction
All Implemented Interfaces:
Bytecodes.InstructionTargeter, java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Bytecodes.GotoInstruction, Bytecodes.IfInstruction, Bytecodes.JsrInstruction, Bytecodes.Select
Enclosing class:
Bytecodes

public abstract static class Bytecodes.BranchInstruction
extends Bytecodes.Instruction
implements Bytecodes.InstructionTargeter


Field Summary
protected  int index
           
protected  int position
           
protected  Bytecodes.InstructionHandle target
           
 
Fields inherited from class Compil3r.BytecodeAnalysis.Bytecodes.Instruction
length, opcode
 
Constructor Summary
(package private) Bytecodes.BranchInstruction()
          Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
protected Bytecodes.BranchInstruction(short opcode, Bytecodes.InstructionHandle target)
          Common super constructor
 
Method Summary
 boolean containsTarget(Bytecodes.InstructionHandle ih)
           
(package private)  void dispose()
          Inform target that it's not targeted anymore.
 void dump(java.io.DataOutputStream out)
          Dump instruction as byte code to stream out.
 int getIndex()
           
 Bytecodes.InstructionHandle getTarget()
           
protected  int getTargetOffset()
           
protected  int getTargetOffset(Bytecodes.InstructionHandle target)
           
protected  void initFromFile(Clazz.jq_ConstantPool cp, Util.IO.ByteSequence bytes, boolean wide)
          Read needed data (e.g.
(package private) static void notifyTarget(Bytecodes.InstructionHandle old_ih, Bytecodes.InstructionHandle new_ih, Bytecodes.InstructionTargeter t)
          Used by BranchInstruction, LocalVariable, CodeException
 void setTarget(Bytecodes.InstructionHandle target)
          Set branch target
 java.lang.String toString(boolean verbose)
          Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>
protected  int updatePosition(int offset, int max_offset)
          Called by InstructionList.setPositions when setting the position for every instruction.
 void updateTarget(Bytecodes.InstructionHandle old_ih, Bytecodes.InstructionHandle new_ih)
           
 
Methods inherited from class Compil3r.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

index

protected int index

target

protected Bytecodes.InstructionHandle target

position

protected int position
Constructor Detail

Bytecodes.BranchInstruction

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


Bytecodes.BranchInstruction

protected Bytecodes.BranchInstruction(short opcode,
                                      Bytecodes.InstructionHandle target)
Common super constructor

Method Detail

dump

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

Overrides:
dump in class Bytecodes.Instruction

getTargetOffset

protected int getTargetOffset(Bytecodes.InstructionHandle target)

getTargetOffset

protected int getTargetOffset()

updatePosition

protected int updatePosition(int offset,
                             int max_offset)
Called by InstructionList.setPositions when setting the position for every instruction. In the presence of variable length instructions `setPositions' performs multiple passes over the instruction list to calculate the correct (byte) positions and offsets by calling this function.


toString

public java.lang.String toString(boolean verbose)
Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>

Overrides:
toString in class Bytecodes.Instruction

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. Conversion to a InstructionHandle is done in InstructionList(byte[]).

Overrides:
initFromFile in class Bytecodes.Instruction

getIndex

public final int getIndex()

getTarget

public Bytecodes.InstructionHandle getTarget()

setTarget

public void setTarget(Bytecodes.InstructionHandle target)
Set branch target


notifyTarget

static final void notifyTarget(Bytecodes.InstructionHandle old_ih,
                               Bytecodes.InstructionHandle new_ih,
                               Bytecodes.InstructionTargeter t)
Used by BranchInstruction, LocalVariable, CodeException


updateTarget

public void updateTarget(Bytecodes.InstructionHandle old_ih,
                         Bytecodes.InstructionHandle new_ih)
Specified by:
updateTarget in interface Bytecodes.InstructionTargeter

containsTarget

public boolean containsTarget(Bytecodes.InstructionHandle ih)
Specified by:
containsTarget in interface Bytecodes.InstructionTargeter

dispose

void dispose()
Inform target that it's not targeted anymore.

Overrides:
dispose in class Bytecodes.Instruction