Class BranchInstruction


  • public class BranchInstruction
    extends Instruction
    This interface describes an instruction that branches to a given offset in the code.
    • Field Detail

      • branchOffset

        public int branchOffset
    • Constructor Detail

      • BranchInstruction

        public BranchInstruction()
        Creates an uninitialized BranchInstruction.
      • BranchInstruction

        public BranchInstruction​(byte opcode,
                                 int branchOffset)
        Creates a BranchInstruction with the given branch offset. The branch offset is relative to this instruction's offset.
    • Method Detail

      • copy

        public BranchInstruction copy​(BranchInstruction branchInstruction)
        Copies the given instruction into this instruction.
        Parameters:
        branchInstruction - the instruction to be copied.
        Returns:
        this instruction.
      • canonicalOpcode

        public byte canonicalOpcode()
        Description copied from class: Instruction
        Returns the canonical opcode of this instruction, i.e. typically the opcode whose extension has been removed.
        Overrides:
        canonicalOpcode in class Instruction
      • shrink

        public Instruction shrink()
        Description copied from class: Instruction
        Shrinks this instruction to its shortest possible form.
        Specified by:
        shrink in class Instruction
        Returns:
        this instruction.
      • readInfo

        protected void readInfo​(byte[] code,
                                int offset)
        Description copied from class: Instruction
        Reads the data following the instruction opcode.
        Specified by:
        readInfo in class Instruction
      • writeInfo

        protected void writeInfo​(byte[] code,
                                 int offset)
        Description copied from class: Instruction
        Writes data following the instruction opcode.
        Specified by:
        writeInfo in class Instruction
      • length

        public int length​(int offset)
        Description copied from class: Instruction
        Returns the length in bytes of the instruction.
        Specified by:
        length in class Instruction
      • toString

        public java.lang.String toString​(int offset)
        Description copied from class: Instruction
        Returns a description of the instruction, at the given offset.
        Overrides:
        toString in class Instruction
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in class Instruction