< prev index next >

src/share/vm/gc/g1/heapRegion.cpp

Print this page
rev 13288 : imported patch 8181917-refactor-ul-logstream
rev 13289 : [mq]: 8181917-refactor-ul-logstream-delta


 511 
 512   template <class T>
 513   void verify_liveness(T* p) {
 514     T heap_oop = oopDesc::load_heap_oop(p);
 515     Log(gc, verify) log;
 516     if (!oopDesc::is_null(heap_oop)) {
 517       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 518       bool failed = false;
 519       if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
 520         MutexLockerEx x(ParGCRareEvent_lock,
 521           Mutex::_no_safepoint_check_flag);
 522 
 523         if (!_failures) {
 524           log.error("----------");
 525         }
 526         ResourceMark rm;
 527         if (!_g1h->is_in_closed_subset(obj)) {
 528           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 529           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 530             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
 531           // Unconditional write?
 532           LogStream ls(log.error());
 533           print_object(&ls, _containing_obj);
 534           log.error("points to obj " PTR_FORMAT " not in the heap", p2i(obj));
 535         } else {
 536           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 537           HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
 538           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 539             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));
 540           // Unconditional write?
 541           LogStream ls(log.error());
 542           print_object(&ls, _containing_obj);
 543           log.error("points to dead obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 544             p2i(obj), p2i(to->bottom()), p2i(to->end()));
 545           print_object(&ls, obj);
 546         }
 547         log.error("----------");
 548         _failures = true;
 549         failed = true;
 550         _n_failures++;
 551       }
 552     }
 553   }
 554 };
 555 
 556 class VerifyRemSetClosure : public G1VerificationClosure {
 557 public:
 558   VerifyRemSetClosure(G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {}
 559   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 560   virtual void do_oop(oop* p) { do_oop_work(p); }


 581         jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
 582         jbyte cv_field = *_bs->byte_for_const(p);
 583         const jbyte dirty = CardTableModRefBS::dirty_card_val();
 584 
 585         bool is_bad = !(from->is_young()
 586           || to->rem_set()->contains_reference(p)
 587           || (_containing_obj->is_objArray() ?
 588                 cv_field == dirty :
 589                 cv_obj == dirty || cv_field == dirty));
 590         if (is_bad) {
 591           MutexLockerEx x(ParGCRareEvent_lock,
 592             Mutex::_no_safepoint_check_flag);
 593 
 594           if (!_failures) {
 595             log.error("----------");
 596           }
 597           log.error("Missing rem set entry:");
 598           log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
 599             p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
 600           ResourceMark rm;
 601           // Unconditional write?
 602           LogStream ls(log.error());
 603           _containing_obj->print_on(&ls);
 604           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
 605           if (obj->is_oop()) {
 606             obj->print_on(&ls);
 607           }
 608           log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
 609           log.error("----------");
 610           _failures = true;
 611           _n_failures++;
 612         }
 613       }
 614     }
 615   }
 616 };
 617 
 618 // Closure that applies the given two closures in sequence.
 619 class G1Mux2Closure : public OopClosure {
 620   OopClosure* _c1;
 621   OopClosure* _c2;




 511 
 512   template <class T>
 513   void verify_liveness(T* p) {
 514     T heap_oop = oopDesc::load_heap_oop(p);
 515     Log(gc, verify) log;
 516     if (!oopDesc::is_null(heap_oop)) {
 517       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
 518       bool failed = false;
 519       if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
 520         MutexLockerEx x(ParGCRareEvent_lock,
 521           Mutex::_no_safepoint_check_flag);
 522 
 523         if (!_failures) {
 524           log.error("----------");
 525         }
 526         ResourceMark rm;
 527         if (!_g1h->is_in_closed_subset(obj)) {
 528           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 529           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 530             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));

 531           LogStream ls(log.error());
 532           print_object(&ls, _containing_obj);
 533           log.error("points to obj " PTR_FORMAT " not in the heap", p2i(obj));
 534         } else {
 535           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 536           HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj);
 537           log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 538             p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end()));

 539           LogStream ls(log.error());
 540           print_object(&ls, _containing_obj);
 541           log.error("points to dead obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")",
 542             p2i(obj), p2i(to->bottom()), p2i(to->end()));
 543           print_object(&ls, obj);
 544         }
 545         log.error("----------");
 546         _failures = true;
 547         failed = true;
 548         _n_failures++;
 549       }
 550     }
 551   }
 552 };
 553 
 554 class VerifyRemSetClosure : public G1VerificationClosure {
 555 public:
 556   VerifyRemSetClosure(G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {}
 557   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
 558   virtual void do_oop(oop* p) { do_oop_work(p); }


 579         jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
 580         jbyte cv_field = *_bs->byte_for_const(p);
 581         const jbyte dirty = CardTableModRefBS::dirty_card_val();
 582 
 583         bool is_bad = !(from->is_young()
 584           || to->rem_set()->contains_reference(p)
 585           || (_containing_obj->is_objArray() ?
 586                 cv_field == dirty :
 587                 cv_obj == dirty || cv_field == dirty));
 588         if (is_bad) {
 589           MutexLockerEx x(ParGCRareEvent_lock,
 590             Mutex::_no_safepoint_check_flag);
 591 
 592           if (!_failures) {
 593             log.error("----------");
 594           }
 595           log.error("Missing rem set entry:");
 596           log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
 597             p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
 598           ResourceMark rm;

 599           LogStream ls(log.error());
 600           _containing_obj->print_on(&ls);
 601           log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
 602           if (obj->is_oop()) {
 603             obj->print_on(&ls);
 604           }
 605           log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
 606           log.error("----------");
 607           _failures = true;
 608           _n_failures++;
 609         }
 610       }
 611     }
 612   }
 613 };
 614 
 615 // Closure that applies the given two closures in sequence.
 616 class G1Mux2Closure : public OopClosure {
 617   OopClosure* _c1;
 618   OopClosure* _c2;


< prev index next >