Class Select

All Implemented Interfaces:
Cloneable, InstructionTargeter, StackConsumer, StackProducer, VariableLengthInstruction
Direct Known Subclasses:
LOOKUPSWITCH, TABLESWITCH

Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.

We use our super's target property as the default target.

See Also:
  • Field Details

    • match

      @Deprecated protected int[] match
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • indices

      @Deprecated protected int[] indices
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • targets

      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • fixed_length

      @Deprecated protected int fixed_length
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • match_length

      @Deprecated protected int match_length
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
    • padding

      @Deprecated protected int padding
      Deprecated.
      (since 6.0) will be made private; do not access directly, use getter/setter
  • Method Details

    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • containsTarget

      public boolean containsTarget(InstructionHandle ih)
      Description copied from interface: InstructionTargeter
      Tests whether this targeter targets the specified instruction handle.
      Specified by:
      containsTarget in interface InstructionTargeter
      Overrides:
      containsTarget in class BranchInstruction
      Parameters:
      ih - The instruction handle to test.
      Returns:
      true, if ih is target of this instruction.
    • dump

      public void dump(DataOutputStream out) throws IOException
      Dumps instruction as byte code to stream out.
      Overrides:
      dump in class BranchInstruction
      Parameters:
      out - Output stream.
      Throws:
      IOException - Thrown when an I/O exception of some sort has occurred.
    • getIndices

      public int[] getIndices()
      Gets the match target offsets.
      Returns:
      array of match target offsets.
    • getMatchs

      public int[] getMatchs()
      Gets the match indices.
      Returns:
      array of match indices.
    • getTargets

      Gets the match targets.
      Returns:
      array of match targets.
    • initFromFile

      protected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
      Reads needed data (for example index) from file.
      Overrides:
      initFromFile in class BranchInstruction
      Parameters:
      bytes - input stream.
      wide - wide prefix?
      Throws:
      IOException - Thrown if the implementation needs to read data from the file
      See Also:
    • setTarget

      public void setTarget(int i, InstructionHandle target)
      Sets branch target for 'i'th case.
      Parameters:
      i - The case index.
      target - The branch target.
    • toString

      public String toString(boolean verbose)
      Description copied from class: 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 BranchInstruction
      Parameters:
      verbose - long/short format switch.
      Returns:
      mnemonic for instruction.
    • updatePosition

      protected int updatePosition(int offset, int maxOffset)
      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 BranchInstruction
      Parameters:
      offset - additional offset caused by preceding (variable length) instructions.
      maxOffset - The maximum offset that may be caused by these instructions.
      Returns:
      additional offset caused by possible change of this instruction's length.
    • updateTarget

      public void updateTarget(InstructionHandle oldIh, InstructionHandle newIh)
      Description copied from interface: InstructionTargeter
      Replaces the target of this targeter from this old handle to the new handle.
      Specified by:
      updateTarget in interface InstructionTargeter
      Overrides:
      updateTarget in class BranchInstruction
      Parameters:
      oldIh - old target.
      newIh - new target.