Class DalvInsnList

All Implemented Interfaces:
ToHuman

public final class DalvInsnList extends FixedSizeList
List of DalvInsn instances.
  • Constructor Details

    • DalvInsnList

      public DalvInsnList(int size, int regCount)
      Constructs an instance. All indices initially contain null.
      Parameters:
      size - the size of the list
      regCount - count, in register-units, of the number of registers this code block requires.
  • Method Details

    • makeImmutable

      public static DalvInsnList makeImmutable(ArrayList<DalvInsn> list, int regCount)
      Constructs and returns an immutable instance whose elements are identical to the ones in the given list, in the same order.
      Parameters:
      list - non-null; the list to use for elements
      regCount - count, in register-units, of the number of registers this code block requires.
      Returns:
      non-null; an appropriately-constructed instance of this class
    • get

      public DalvInsn 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, DalvInsn insn)
      Sets the instruction at the given index.
      Parameters:
      n - >= 0, < size(); which index
      insn - non-null; the instruction to set at n
    • codeSize

      public int codeSize()
      Gets the size of this instance, in 16-bit code units. This will only return a meaningful result if the instructions in this instance all have valid addresses.
      Returns:
      >= 0; the size
    • writeTo

      public void writeTo(AnnotatedOutput out)
      Writes all the instructions in this instance to the given output destination.
      Parameters:
      out - non-null; where to write to
    • getRegistersSize

      public int getRegistersSize()
      Gets the minimum required register count implied by this instance. This includes any unused parameters that could potentially be at the top of the register space.
      Returns:
      >= 0; the required registers size
    • getOutsSize

      public int getOutsSize()
      Gets the size of the outgoing arguments area required by this method. This is equal to the largest argument word count of any method referred to by this instance.
      Returns:
      >= 0; the required outgoing arguments size
    • debugPrint

      public void debugPrint(Writer out, String prefix, boolean verbose)
      Does a human-friendly dump of this instance.
      Parameters:
      out - non-null; where to dump
      prefix - non-null; prefix to attach to each line of output
      verbose - whether to be verbose; verbose output includes lines for zero-size instructions and explicit constant pool indices
    • debugPrint

      public void debugPrint(OutputStream out, String prefix, boolean verbose)
      Does a human-friendly dump of this instance.
      Parameters:
      out - non-null; where to dump
      prefix - non-null; prefix to attach to each line of output
      verbose - whether to be verbose; verbose output includes lines for zero-size instructions