Klasse InstructionBranch

java.lang.Object
org.aspectj.apache.bcel.generic.Instruction
org.aspectj.apache.bcel.generic.InstructionBranch
Alle implementierten Schnittstellen:
Serializable, Cloneable, Constants, InstructionTargeter
Bekannte direkte Unterklassen:
InstructionSelect

public class InstructionBranch extends Instruction implements InstructionTargeter
Abstract super class for branching instructions like GOTO, IFEQ, etc.. Branch instructions may have a variable length, namely GOTO, JSR, LOOKUPSWITCH and TABLESWITCH. A branch instruction may be talking in terms of absolute destination (targetIndex) or about an instruction it doesnt yet know the position if (targetInstruction). targetInstruction (if set) overrides targetIndex
Version:
$Id: InstructionBranch.java,v 1.6 2009/10/05 17:35:36 aclement Exp $
Autor:
M. Dahm
Siehe auch:
  • Felddetails

    • targetIndex

      protected int targetIndex
    • targetInstruction

      protected InstructionHandle targetInstruction
    • positionOfThisInstruction

      protected int positionOfThisInstruction
  • Konstruktordetails

    • InstructionBranch

      public InstructionBranch(short opcode, InstructionHandle target)
    • InstructionBranch

      public InstructionBranch(short opcode, int index)
    • InstructionBranch

      public InstructionBranch(short opcode)
  • Methodendetails

    • dump

      public void dump(DataOutputStream out) throws IOException
      Setzt außer Kraft:
      dump in Klasse Instruction
      Löst aus:
      IOException
    • 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.
      Parameter:
      offset - additional offset caused by preceding (variable length) instructions
      max_offset - the maximum offset that may be caused by these instructions
      Gibt zurück:
      additional offset caused by possible change of this instruction's length
    • toString

      public String toString(boolean verbose)
      Long output format:
      Setzt außer Kraft:
      toString in Klasse Instruction
      Parameter:
      verbose - long/short format switch
      Gibt zurück:
      mnemonic for instruction
    • getIndex

      public final int getIndex()
      Setzt außer Kraft:
      getIndex in Klasse Instruction
      Gibt zurück:
      target offset in byte code
    • getTarget

      public InstructionHandle getTarget()
      Gibt zurück:
      target of branch instruction
    • setTarget

      public void setTarget(InstructionHandle target)
      Set branch target
      Parameter:
      target - branch target
    • updateTarget

      public void updateTarget(InstructionHandle oldHandle, InstructionHandle newHandle)
      Update the target destination for this instruction. If an oldHandle is provided it is checked to verify that is where the target currently points to before changing it.
      Angegeben von:
      updateTarget in Schnittstelle InstructionTargeter
      Parameter:
      oldHandle - old target
      newHandle - new target
    • containsTarget

      public boolean containsTarget(InstructionHandle ih)
      Angegeben von:
      containsTarget in Schnittstelle InstructionTargeter
      Gibt zurück:
      true, if ih is target of this instruction
    • getType

      public Type getType(ConstantPool cp)
      Setzt außer Kraft:
      getType in Klasse Instruction
    • physicalSuccessor

      public InstructionHandle physicalSuccessor()
      Returns an InstructionHandle to the physical successor of this JsrInstruction. For this method to work, this JsrInstruction object must not be shared between multiple InstructionHandle objects! Formally, there must not be InstructionHandle objects i, j where i != j and i.getInstruction() == this == j.getInstruction().
      Gibt zurück:
      an InstructionHandle to the "next" instruction that will be executed when RETurned from a subroutine.
    • isIfInstruction

      public boolean isIfInstruction()
    • equals

      public boolean equals(Object other)
      Only equal if they are the same branch instruction - otherwise too risky as the targets may only temporarily be pointing at the same destination.
      Setzt außer Kraft:
      equals in Klasse Instruction
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Instruction