< prev index next >

src/hotspot/share/opto/subtypenode.cpp

Print this page
*** 57,10 ***
--- 57,31 ---
        // subk is either a supertype of superk, or null. In either case, superk is a subtype.
        return TypeInt::CC_GT;
      }
    }
  
+   // FIXME: shouldn't this be encoded in helper methods of the type system (maybe_java_subtype_of() etc.?)
+   // Similar to logic in CmpPNode::sub()
+   bool unrelated_classes = false;
+   // Handle inline type arrays
+   if (subk->flat_in_array() && superk->not_flat_in_array()) {
+     // The subtype is in flat arrays and the supertype is not in flat arrays. Must be unrelated.
+     unrelated_classes = true;
+   } else if (subk->is_not_flat() && superk->is_flat()) {
+     // The subtype is a non-flat array and the supertype is a flat array. Must be unrelated.
+     unrelated_classes = true;
+   } else if (subk->is_not_null_free() && superk->is_null_free()) {
+     // The subtype is a nullable array and the supertype is null-free array. 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;
+     }
+   }
+ 
    if (subk != nullptr) {
      switch (Compile::current()->static_subtype_check(superk, subk, false)) {
        case Compile::SSC_always_false:
          return TypeInt::CC_GT;
        case Compile::SSC_always_true:
< prev index next >