Class RetInstruction

    • Constructor Detail

      • RetInstruction

        public RetInstruction​(int opcode,
                              int offset,
                              int varIndex)
        Constructs a RetInstruction.
        Parameters:
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        varIndex - The local variable index.
    • Method Detail

      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the RET opcode and its operand to the DataOutputStream.
        Specified by:
        write in class Instruction
        Parameters:
        dos - The DataOutputStream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getStackChange

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

        public int getLocalChange()
        Returns the change in local variables caused by this instruction.
        Specified by:
        getLocalChange in class Instruction
        Returns:
        The local variables size change (none).
      • getVarIndex

        public int getVarIndex()
        Returns the local variable index.
        Specified by:
        getVarIndex in interface LocalVarInstruction
        Returns:
        The local variable index.
      • toString

        public String toString()
        Returns a string representation of the instruction.
        Overrides:
        toString in class Instruction
        Returns:
        The mnemonic and variable index of the instruction.