Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8220416

Comparison of klass pointers is not optimized any more

XMLWordPrintable

    • b15

      I noticed this:

        if (p0 && p1) {
          Node* in1 = in(1)->uncast();
          Node* in2 = in(2)->uncast();
          AllocateNode* alloc1 = AllocateNode::Ideal_allocation(in1, NULL);
          AllocateNode* alloc2 = AllocateNode::Ideal_allocation(in2, NULL);
          if (MemNode::detect_ptr_independence(in1, alloc1, in2, alloc2, NULL)) {
            return TypeInt::CC_GT; // different pointers
          }
          ciKlass* klass0 = p0->klass();
          bool xklass0 = p0->klass_is_exact();
          ciKlass* klass1 = p1->klass();
          bool xklass1 = p1->klass_is_exact();
          int kps = (p0->isa_klassptr()?1:0) + (p1->isa_klassptr()?1:0);
          if (klass0 && klass1 &&
              kps != 1 && // both or neither are klass pointers
              klass0->is_loaded() && !klass0->is_interface() && // do not trust interfaces
              klass1->is_loaded() && !klass1->is_interface() &&
              (!klass0->is_obj_array_klass() ||
               !klass0->as_obj_array_klass()->base_element_klass()->is_interface()) &&
              (!klass1->is_obj_array_klass() ||
               !klass1->as_obj_array_klass()->base_element_klass()->is_interface())) {

      in CmpPNode::sub() doesn't trigger for klass pointers comparisons since JDK-6964458 because TypeKlassPtr doesn't subclass TypeOopPtr anymore.

            chagedorn Christian Hagedorn
            roland Roland Westrelin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: