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

Quick Search    Search Deep

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

java.lang.Object
  extended byCompil3r.BytecodeAnalysis.Bytecodes.Instruction
      extended byCompil3r.BytecodeAnalysis.Bytecodes.BranchInstruction
          extended byCompil3r.BytecodeAnalysis.Bytecodes.Select
All Implemented Interfaces:
Bytecodes.InstructionTargeter, Bytecodes.StackProducer, Bytecodes.VariableLengthInstruction, java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Bytecodes.LOOKUPSWITCH, Bytecodes.TABLESWITCH
Enclosing class:
Bytecodes

public abstract static class Bytecodes.Select
extends Bytecodes.BranchInstruction
implements Bytecodes.VariableLengthInstruction, Bytecodes.StackProducer


Field Summary
protected  int fixed_length
           
protected  int[] indices
           
protected  int[] match
           
protected  int match_length
           
protected  int padding
           
protected  java.util.ArrayList targets
           
 
Fields inherited from class Compil3r.BytecodeAnalysis.Bytecodes.BranchInstruction
index, position, target
 
Fields inherited from class Compil3r.BytecodeAnalysis.Bytecodes.Instruction
length, opcode
 
Constructor Summary
(package private) Bytecodes.Select()
          Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
(package private) Bytecodes.Select(short opcode, int[] match, java.util.ArrayList targets, Bytecodes.InstructionHandle target)
          (Match, target) pairs for switch.
 
Method Summary
 boolean containsTarget(Bytecodes.InstructionHandle ih)
           
(package private)  void dispose()
          Inform targets that they're not targeted anymore.
 void dump(java.io.DataOutputStream out)
          Dump instruction as byte code to stream out.
 int[] getIndices()
           
 int[] getMatchs()
           
 java.util.List getTargets()
           
protected  void initFromFile(Clazz.jq_ConstantPool cp, Util.IO.ByteSequence bytes, boolean wide)
          Read needed data (e.g.
 void setTarget(int i, Bytecodes.InstructionHandle target)
          Set branch target for `i'th case
 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)
          Since this is a variable length instruction, it may shift the following instructions which then need to update their position.
 void updateTarget(Bytecodes.InstructionHandle old_ih, Bytecodes.InstructionHandle new_ih)
           
 
Methods inherited from class Compil3r.BytecodeAnalysis.Bytecodes.BranchInstruction
getIndex, getTarget, getTargetOffset, getTargetOffset, notifyTarget, setTarget
 
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
 
Methods inherited from interface Compil3r.BytecodeAnalysis.Bytecodes.StackProducer
produceStack
 

Field Detail

match

protected int[] match

indices

protected int[] indices

targets

protected java.util.ArrayList targets

fixed_length

protected int fixed_length

match_length

protected int match_length

padding

protected int padding
Constructor Detail

Bytecodes.Select

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


Bytecodes.Select

Bytecodes.Select(short opcode,
                 int[] match,
                 java.util.ArrayList targets,
                 Bytecodes.InstructionHandle target)
(Match, target) pairs for switch. `Match' and `targets' must have the same length of course.

Method Detail

updatePosition

protected int updatePosition(int offset,
                             int max_offset)
Since this is a variable length instruction, it may shift the following instructions which then need to update their position. 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.

Overrides:
updatePosition in class Bytecodes.BranchInstruction

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.BranchInstruction

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.

Overrides:
initFromFile in class Bytecodes.BranchInstruction

toString

public java.lang.String toString(boolean verbose)
Description copied from class: Bytecodes.BranchInstruction
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.BranchInstruction

setTarget

public void setTarget(int i,
                      Bytecodes.InstructionHandle target)
Set branch target for `i'th case


updateTarget

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

containsTarget

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

dispose

void dispose()
Inform targets that they're not targeted anymore.

Overrides:
dispose in class Bytecodes.BranchInstruction

getMatchs

public int[] getMatchs()

getIndices

public int[] getIndices()

getTargets

public java.util.List getTargets()