Class InsnList

All Implemented Interfaces:
ToHuman

public final class InsnList extends FixedSizeList
List of Insn instances.
  • Constructor Details

    • InsnList

      public InsnList(int size)
      Constructs an instance. All indices initially contain null.
      Parameters:
      size - the size of the list
  • Method Details

    • get

      public Insn get(int n)
      Gets the element at the given index. It is an error to call this with the index for an element which was never set; if you do that, this will throw NullPointerException.
      Parameters:
      n - >= 0, < size(); which index
      Returns:
      non-null; element at that index
    • set

      public void set(int n, Insn insn)
      Sets the instruction at the given index.
      Parameters:
      n - >= 0, < size(); which index
      insn - non-null; the instruction to set at n
    • getLast

      public Insn getLast()
      Gets the last instruction. This is just a convenient shorthand for get(size() - 1).
      Returns:
      non-null; the last instruction
    • forEach

      public void forEach(Insn.Visitor visitor)
      Visits each instruction in the list, in order.
      Parameters:
      visitor - non-null; visitor to use
    • contentEquals

      public boolean contentEquals(InsnList b)
      Compares the contents of this InsnList with another. The blocks must have the same number of insns, and each Insn must also return true to Insn.contentEquals().
      Parameters:
      b - to compare
      Returns:
      true in the case described above.
    • withRegisterOffset

      public InsnList withRegisterOffset(int delta)
      Returns an instance that is identical to this one, except that the registers in each instruction are offset by the given amount. Mutability of the result is inherited from the original.
      Parameters:
      delta - the amount to offset register numbers by
      Returns:
      non-null; an appropriately-constructed instance