< prev index next >

src/hotspot/share/opto/subtypenode.cpp

Print this page
*** 44,24 ***
        Compile::current()->dependencies()->assert_leaf_type(superklass);
        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:
!         return TypeInt::CC_EQ;
!       case Compile::SSC_easy_test:
!       case Compile::SSC_full_test:
!         break;
!       default:
!         ShouldNotReachHere();
      }
    }
  
    return bottom_type();
  }
  
  Node *SubTypeCheckNode::Ideal(PhaseGVN* phase, bool can_reshape) {
    Node* obj_or_subklass = in(ObjOrSubKlass);
--- 44,43 ---
        Compile::current()->dependencies()->assert_leaf_type(superklass);
        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_inexact()) {
!     // The subtype is in flat arrays and the supertype is not in flat arrays and no subklass can be. 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;
      }
    }
  
+   switch (Compile::current()->static_subtype_check(superk, subk, false)) {
+     case Compile::SSC_always_false:
+       return TypeInt::CC_GT;
+     case Compile::SSC_always_true:
+       return TypeInt::CC_EQ;
+     case Compile::SSC_easy_test:
+     case Compile::SSC_full_test:
+       break;
+     default:
+       ShouldNotReachHere();
+   }
+ 
    return bottom_type();
  }
  
  Node *SubTypeCheckNode::Ideal(PhaseGVN* phase, bool can_reshape) {
    Node* obj_or_subklass = in(ObjOrSubKlass);

*** 131,11 ***
      phase->is_IterGVN()->_worklist.push(n); // record for cleanup
    }
    return n;
  }
  bool SubTypeCheckNode::verify_helper(PhaseGVN* phase, Node* subklass, const Type* cached_t) {
!   Node* cmp = phase->transform(new CmpPNode(subklass, in(SuperKlass)));
    record_for_cleanup(cmp, phase);
  
    const Type* cmp_t = phase->type(cmp);
    const Type* t = Value(phase);
  
--- 150,12 ---
      phase->is_IterGVN()->_worklist.push(n); // record for cleanup
    }
    return n;
  }
  bool SubTypeCheckNode::verify_helper(PhaseGVN* phase, Node* subklass, const Type* cached_t) {
!   Node* cmp_orig = new CmpPNode(subklass, in(SuperKlass));
+   Node* cmp = phase->transform(cmp_orig);
    record_for_cleanup(cmp, phase);
  
    const Type* cmp_t = phase->type(cmp);
    const Type* t = Value(phase);
  

*** 144,13 ***
        (cmp_t != TypeInt::CC_GT && cmp_t != TypeInt::CC_EQ)) {
      return true;
    } else {
      t->dump(); tty->cr();
      this->dump(2); tty->cr();
      cmp_t->dump(); tty->cr();
!     subklass->dump(2); tty->cr();
!     tty->print_cr("==============================");
      phase->C->root()->dump(9999);
      return false;
    }
  }
  
--- 164,14 ---
        (cmp_t != TypeInt::CC_GT && cmp_t != TypeInt::CC_EQ)) {
      return true;
    } else {
      t->dump(); tty->cr();
      this->dump(2); tty->cr();
+     tty->print_cr("VS.\n");
      cmp_t->dump(); tty->cr();
!     cmp_orig->dump(2); tty->cr();
!     tty->print_cr("==============================\n");
      phase->C->root()->dump(9999);
      return false;
    }
  }
  

*** 185,11 ***
          Node* p1 = phase->transform(new AddPNode(superklass, superklass, phase->MakeConX(in_bytes(Klass::super_check_offset_offset()))));
          Node* chk_off = phase->transform(new LoadINode(nullptr, C->immutable_memory(), p1, phase->type(p1)->is_ptr(), TypeInt::INT, MemNode::unordered));
          record_for_cleanup(chk_off, phase);
  
          int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
!         bool might_be_cache = (phase->find_int_con(chk_off, cacheoff_con) == cacheoff_con);
          if (!might_be_cache) {
            Node* subklass = load_klass(phase);
            Node* chk_off_X = chk_off;
  #ifdef _LP64
            chk_off_X = phase->transform(new ConvI2LNode(chk_off_X));
--- 206,11 ---
          Node* p1 = phase->transform(new AddPNode(superklass, superklass, phase->MakeConX(in_bytes(Klass::super_check_offset_offset()))));
          Node* chk_off = phase->transform(new LoadINode(nullptr, C->immutable_memory(), p1, phase->type(p1)->is_ptr(), TypeInt::INT, MemNode::unordered));
          record_for_cleanup(chk_off, phase);
  
          int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset());
!         bool might_be_cache = phase->find_int_con(chk_off, cacheoff_con) == cacheoff_con;
          if (!might_be_cache) {
            Node* subklass = load_klass(phase);
            Node* chk_off_X = chk_off;
  #ifdef _LP64
            chk_off_X = phase->transform(new ConvI2LNode(chk_off_X));

*** 241,6 ***
      st->print(" profiled at:");
      _method->print_short_name(st);
      st->print(":%d", _bci);
    }
  }
! #endif
--- 262,6 ---
      st->print(" profiled at:");
      _method->print_short_name(st);
      st->print(":%d", _bci);
    }
  }
! #endif
< prev index next >