Package serp.bytecode

Class LookupSwitchInstruction

    • Field Detail

      • _matches

        private java.util.List _matches
      • _cases

        private java.util.List _cases
    • Constructor Detail

      • LookupSwitchInstruction

        LookupSwitchInstruction​(Code owner)
    • Method Detail

      • getLength

        int getLength()
        Description copied from class: Instruction
        Return the length in bytes of this opcode, including all arguments. For many opcodes this method relies on an up-to-date byte index.
        Overrides:
        getLength in class Instruction
      • getStackChange

        public int getStackChange()
        Description copied from class: Instruction
        Return the number of stack positions this instruction pushes or pops during its execution.
        Overrides:
        getStackChange in class Instruction
        Returns:
        0 if the stack is not affected by this instruction, a positive number if it pushes onto the stack, and a negative number if it pops from the stack
      • setCases

        public LookupSwitchInstruction setCases​(int[] matches,
                                                Instruction[] targets)
        Set the match-jumppt pairs for this switch.
        Returns:
        this instruction, for method chaining
      • getOffsets

        public int[] getOffsets()
      • getMatches

        public int[] getMatches()
        Return the values of the case statements for this switch.
      • getTargets

        public Instruction[] getTargets()
        Return the targets of the case statements for this switch.
      • findJumpPoint

        private Instruction findJumpPoint​(int jumpByteIndex,
                                          java.util.List inss)
      • updateTargets

        public void updateTargets()
        Description copied from interface: InstructionPtr
        Use the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr. This method will be called after the byte code has been read in for the first time and before it is written after modification.
        Specified by:
        updateTargets in interface InstructionPtr
        Overrides:
        updateTargets in class JumpInstruction
      • acceptVisit

        public void acceptVisit​(BCVisitor visit)
        Description copied from interface: VisitAcceptor
        Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
        Specified by:
        acceptVisit in interface VisitAcceptor
        Overrides:
        acceptVisit in class JumpInstruction
      • read

        void read​(java.io.DataInput in)
           throws java.io.IOException
        Description copied from class: Instruction
        Read the arguments for this opcode from the given stream. This method should be overridden by opcodes that take arguments.
        Overrides:
        read in class JumpInstruction
        Throws:
        java.io.IOException
      • write

        void write​(java.io.DataOutput out)
            throws java.io.IOException
        Description copied from class: Instruction
        Write the arguments for this opcode to the given stream. This method should be overridden by opcodes that take arguments.
        Overrides:
        write in class JumpInstruction
        Throws:
        java.io.IOException