< prev index next >

src/hotspot/share/opto/subtypenode.cpp

Print this page
@@ -74,10 +74,24 @@
      } else {
        // Neither class subtypes the other: they are unrelated and this
        // type check is known to fail.
        unrelated_classes = true;
      }
+     if (!unrelated_classes) {
+       // Handle inline type arrays
+       if (sub_t->isa_aryptr() && sub_t->is_aryptr()->is_not_flat() && superk->is_flat_array_klass()) {
+         // Subtype is not a flat array but supertype is. Must be unrelated.
+         unrelated_classes = true;
+       } else if (sub_t->isa_aryptr() && sub_t->is_aryptr()->is_not_null_free() &&
+                  superk->is_array_klass() && superk->as_array_klass()->is_elem_null_free()) {
+         // Subtype is not a null-free array but supertype is. Must be unrelated.
+         unrelated_classes = true;
+       } else if (sub_t->is_ptr()->flatten_array() && (!superk->can_be_inline_klass() || (superk->is_inlinetype() && !superk->flatten_array()))) {
+         // Subtype is flattened in arrays but supertype is not. Must be unrelated.
+         unrelated_classes = true;
+       }
+     }
      if (unrelated_classes) {
        TypePtr::PTR jp = sub_t->is_ptr()->join_ptr(super_t->is_ptr()->_ptr);
        if (jp != TypePtr::Null && jp != TypePtr::BotPTR) {
          return TypeInt::CC_GT;
        }
< prev index next >