Class Instruction

    • Constructor Detail

      • Instruction

        public Instruction​(int opcode,
                           int offset,
                           int length)
        Constructs an Instruction.
        Parameters:
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        length - The length of the instruction in bytes.
    • Method Detail

      • getOpcode

        public int getOpcode()
        Returns:
        the opcode
      • getOffset

        public int getOffset()
        Returns:
        the offset
      • getLength

        public int getLength()
        Returns:
        the encoded length of the instruction in bytes
      • setOffset

        public void setOffset​(int offset)
        Updates this instruction's bytecode offset.
        Parameters:
        offset - the new bytecode offset
      • accept

        public abstract void accept​(AbstractBytecodeVisitor visitor)
        Accepts a visitor for bytecode analysis.
        Parameters:
        visitor - The visitor to accept.
      • write

        public abstract void write​(DataOutputStream dos)
                            throws IOException
        Writes the instruction to the DataOutputStream.
        Parameters:
        dos - The DataOutputStream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getStackChange

        public abstract int getStackChange()
        Returns the change in stack size caused by this instruction.
        Returns:
        The stack size change.
      • getLocalChange

        public abstract int getLocalChange()
        Returns the change in local variables caused by this instruction.
        Returns:
        The local variables size change.