< prev index next >

src/hotspot/share/ci/ciTypeFlow.cpp

Print this page

        

@@ -271,10 +271,16 @@
 //   kind is their least common ancestor.  The meet of two types of
 //   different kinds is always java.lang.Object.
 ciType* ciTypeFlow::StateVector::type_meet_internal(ciType* t1, ciType* t2, ciTypeFlow* analyzer) {
   assert(t1 != t2, "checked in caller");
 
+  // Unwrap the types after gathering nullness information
+  bool never_null1 = t1->is_never_null();
+  bool never_null2 = t2->is_never_null();
+  t1 = t1->unwrap();
+  t2 = t2->unwrap();
+
   if (t1->equals(top_type())) {
     return t2;
   } else if (t2->equals(top_type())) {
     return t1;
   } else if (t1->is_primitive_type() || t2->is_primitive_type()) {

@@ -293,16 +299,10 @@
     // At least one of the two types is a non-top primitive type.
     // The other type is not equal to it.  Fall to bottom.
     return bottom_type();
   }
 
-  // Unwrap the types after gathering nullness information
-  bool never_null1 = t1->is_never_null();
-  bool never_null2 = t2->is_never_null();
-  t1 = t1->unwrap();
-  t2 = t2->unwrap();
-
   // Both types are non-top non-primitive types.  That is,
   // both types are either instanceKlasses or arrayKlasses.
   ciKlass* object_klass = analyzer->env()->Object_klass();
   ciKlass* k1 = t1->as_klass();
   ciKlass* k2 = t2->as_klass();

@@ -626,14 +626,13 @@
     // 1) C2 uses do_null_assert() and continues compilation for later blocks
     // 2) C2 does an OSR compile in a later block (see bug 4778368).
     pop_object();
     do_null_assert(klass);
   } else {
-    pop_object();
-    if (str->is_klass_never_null()) {
+    ciType* type = pop_value();
+    if (klass->is_valuetype() && (str->is_klass_never_null() || type->is_never_null())) {
       // Casting to a Q-Type contains a NULL check
-      assert(klass->is_valuetype(), "must be a value type");
       push(outer()->mark_as_never_null(klass));
     } else {
       push_object(klass);
     }
   }
< prev index next >