public static DalvInsnList makeImmutable(ArrayList<DalvInsn> list, int regCount) {
    int size = list.size();
    DalvInsnList result = new DalvInsnList(size, regCount);

    for (int i = 0; i < size; i++) {
      result.set(i, list.get(i));
    }

    result.setImmutable();
    return result;
  }
Constructs and returns an immutable instance whose elements are identical to the ones in the
given list, in the same order.

@param list {@code non-null;} the list to use for elements
@param regCount count, in register-units, of the number of registers this code block requires.
@return {@code non-null;} an appropriately-constructed instance of this class
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/DalvInsnList.java