Class Select

    • Field Detail

      • 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
        protected InstructionHandle[] 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
    • Constructor Detail

      • Select

        Select()
        Empty constructor needed for Instruction.readInstruction. Not to be used otherwise.
      • Select

        Select​(short opcode,
               int[] match,
               InstructionHandle[] targets,
               InstructionHandle defaultTarget)
        (Match, target) pairs for switch. 'Match' and 'targets' must have the same length of course.
        Parameters:
        match - array of matching values
        targets - instruction targets
        defaultTarget - default instruction target
    • Method Detail

      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • dispose

        void dispose()
        Inform targets that they're not targeted anymore.
        Overrides:
        dispose in class 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 BranchInstruction
        Parameters:
        out - Output stream
        Throws:
        java.io.IOException - Thrown when an I/O exception of some sort has occurred.
      • getFixedLength

        final int getFixedLength()
        Returns:
        the fixed_length
        Since:
        6.0
      • getIndices

        public int[] getIndices()
        Returns:
        array of match target offsets
      • getIndices

        final int getIndices​(int index)
        Returns:
        index entry from indices
        Since:
        6.0
      • getMatch

        final int getMatch​(int index)
        Returns:
        match entry
        Since:
        6.0
      • getMatchLength

        final int getMatchLength()
        Returns:
        the match_length
        Since:
        6.0
      • getMatchs

        public int[] getMatchs()
        Returns:
        array of match indices
      • getPadding

        final int getPadding()
        Returns:
        the padding
        Since:
        6.0
      • getTarget

        final InstructionHandle getTarget​(int index)
        Returns:
        target entry
        Since:
        6.0
      • getTargets

        public InstructionHandle[] getTargets()
        Returns:
        array of match targets
      • initFromFile

        protected void initFromFile​(ByteSequence bytes,
                                    boolean wide)
                             throws java.io.IOException
        Read needed data (e.g. index) from file.
        Overrides:
        initFromFile in class BranchInstruction
        Parameters:
        bytes - input stream
        wide - wide prefix?
        Throws:
        java.io.IOException - may be thrown if the implementation needs to read data from the file
        See Also:
        InstructionList
      • setFixedLength

        final void setFixedLength​(int fixedLength)
        Parameters:
        fixedLength - the fixed_length to set
        Since:
        6.0
      • setIndices

        final int setIndices​(int i,
                             int value)
        Since:
        6.0
      • setIndices

        final void setIndices​(int[] array)
        Parameters:
        array -
        Since:
        6.0
      • setMatch

        final void setMatch​(int index,
                            int value)
        Parameters:
        index -
        value -
        Since:
        6.0
      • setMatches

        final void setMatches​(int[] array)
        Parameters:
        array -
        Since:
        6.0
      • setMatchLength

        final int setMatchLength​(int matchLength)
        Parameters:
        matchLength - the match_length to set
        Since:
        6.0
      • setTarget

        public void setTarget​(int i,
                              InstructionHandle target)
        Set branch target for 'i'th case
      • setTargets

        final void setTargets​(InstructionHandle[] array)
        Parameters:
        array -
        Since:
        6.0
      • toString

        public java.lang.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