VM.assert(t1 != t2);
VM._assert(t1 != t2);
  static public VM_Type findCommonSuperclass (VM_Type t1, VM_Type t2) {    if (t1 == t2)      return  t1;    if (t1.isPrimitiveType() && t2.isPrimitiveType()) {      VM_Type type = null;      if (t1.isIntLikeType() && t2.isIntLikeType()) {        if (t1.isAddressType() || t2.isAddressType())          return OPT_ClassLoaderProxy.AddressType;        if (t1.isIntType() || t2.isIntType())          return  OPT_ClassLoaderProxy.IntType;        if (t1.isCharType() || t2.isCharType())          return  OPT_ClassLoaderProxy.CharType;        if (t1.isShortType() || t2.isShortType())          return  OPT_ClassLoaderProxy.ShortType;        if (t1.isByteType() || t2.isByteType())          return  OPT_ClassLoaderProxy.ByteType;      }      return  null;    }    if (!((t1.isReferenceType() || t1.isAddressType()) &&           (t2.isReferenceType() || t2.isAddressType())))      return null;    // can these next two cases happen?    if (t1 == NULL_TYPE)      return  t2;    if (t2 == NULL_TYPE)      return  t1;    if (OPT_IRGenOptions.DBG_TYPE)      VM.sysWrite("finding common supertype of " + t1 + " and " + t2);    // Strip off all array junk.    int arrayDimensions = 0;    while (t1.isArrayType() && t2.isArrayType()) {      ++arrayDimensions;      t1 = ((VM_Array)t1).getElementType();      t2 = ((VM_Array)t2).getElementType();    }    // at this point, they are not both array types.    // if one is a primitive, then we want an object array of one less    // dimensionality    if (t1.isPrimitiveType() || t1.isPrimitiveType()) {      if (VM.VerifyAssertions)        VM.assert(t1 != t2);      VM_Type type = JavaLangObjectType;      --arrayDimensions;      while (arrayDimensions-- > 0)        type = type.getArrayTypeForElementType();      if (OPT_IRGenOptions.DBG_TYPE)        VM.sysWrite("one is a primitive array, so supertype is " + type);      return  type;    }    // neither is a primitive, and they are not both array types.    if (!t1.isClassType() || !t2.isClassType()) {      // one is a class type, while the other isn't.      VM_Type type = OPT_ClassLoaderProxy.JavaLangObjectType;      while (arrayDimensions-- > 0)        type = type.getArrayTypeForElementType();      if (OPT_IRGenOptions.DBG_TYPE)        VM.sysWrite("differing dimensionalities for arrays, so supertype is "                    + type);      return  type;    }    // they both must be class types.    // technique: push heritage of each type on a separate stack,    // then find the highest point in the stack where they differ.    VM_Class c1 = (VM_Class)t1;    VM_Class c2 = (VM_Class)t2;    OPT_Stack s1 = new OPT_Stack();    if (c1.isLoaded() && c2.isLoaded()) {      // The ancestor hierarchy is available, so do this exactly      do {        s1.push(c1);        c1 = c1.getSuperClass();      } while (c1 != null);      OPT_Stack s2 = new OPT_Stack();      do {        s2.push(c2);        c2 = c2.getSuperClass();      } while (c2 != null);      if (OPT_IRGenOptions.DBG_TYPE)        VM.sysWrite("stack 1: " + s1);      if (OPT_IRGenOptions.DBG_TYPE)        VM.sysWrite("stack 2: " + s2);      VM_Type best = OPT_ClassLoaderProxy.JavaLangObjectType;      while (!s1.empty() && !s2.empty()) {        VM_Class temp = (VM_Class)s1.pop();        if (temp == s2.pop())          best = temp;         else           break;      }      if (OPT_IRGenOptions.DBG_TYPE)        VM.sysWrite("common supertype of the two classes is " + best);      while (arrayDimensions-- > 0)        best = best.getArrayTypeForElementType();      return  best;    } else {      if (OPT_IRGenOptions.DBG_TYPE && !c1.isLoaded())        VM.sysWrite(c1 + " is not loaded, using Object as common supertype");      if (OPT_IRGenOptions.DBG_TYPE && !c2.isLoaded())        VM.sysWrite(c2 + " is not loaded, using Object as common supertype");      VM_Type common = OPT_ClassLoaderProxy.JavaLangObjectType;      while (arrayDimensions-- > 0)        common = common.getArrayTypeForElementType();      return  common;    }  }