public void intersect(RegisterSpecSet other, boolean localPrimary) {
    throwIfImmutable();

    RegisterSpec[] otherSpecs = other.specs;
    int thisLen = specs.length;
    int len = Math.min(thisLen, otherSpecs.length);

    size = -1;

    for (int i = 0; i < len; i++) {
      RegisterSpec spec = specs[i];

      if (spec == null) {
        continue;
      }

      RegisterSpec intersection = spec.intersect(otherSpecs[i], localPrimary);
      if (intersection != spec) {
        specs[i] = intersection;
      }
    }

    for (int i = len; i < thisLen; i++) {
      specs[i] = null;
    }
  }
Intersects this instance with the given one, modifying this instance. The intersection consists
of the pairwise {@link RegisterSpec#intersect} of corresponding elements from this instance and
the given one where both are non-null.

@param other {@code non-null;} set to intersect with
@param localPrimary whether local variables are primary to the intersection; if {@code true},
    then the only non-null result elements occur when registers being intersected have equal
    names (or both have {@code null} names)
android/android_framework/dex-maker/src/main/java/com/android/dx/rop/code/RegisterSpecSet.java