< prev index next >

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

Print this page
rev 11552 : imported patch 8159978-collection-set-as-array
rev 11553 : imported patch 8159978-erikh-review


 563   ct_bs->verify_not_dirty_region(mr);
 564 }
 565 
 566 void G1HeapVerifier::verify_dirty_region(HeapRegion* hr) {
 567   // We cannot guarantee that [bottom(),end()] is dirty.  Threads
 568   // dirty allocated blocks as they allocate them. The thread that
 569   // retires each region and replaces it with a new one will do a
 570   // maximal allocation to fill in [pre_dummy_top(),end()] but will
 571   // not dirty that area (one less thing to have to do while holding
 572   // a lock). So we can only verify that [bottom(),pre_dummy_top()]
 573   // is dirty.
 574   G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set();
 575   MemRegion mr(hr->bottom(), hr->pre_dummy_top());
 576   if (hr->is_young()) {
 577     ct_bs->verify_g1_young_region(mr);
 578   } else {
 579     ct_bs->verify_dirty_region(mr);
 580   }
 581 }
 582 
 583 void G1HeapVerifier::verify_dirty_young_list(HeapRegion* head) {
 584   G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set();
 585   for (HeapRegion* hr = head; hr != NULL; hr = hr->next_in_collection_set()) {
 586     verify_dirty_region(hr);




 587   }
 588 }
 589 
 590 void G1HeapVerifier::verify_dirty_young_regions() {
 591   verify_dirty_young_list(_g1h->collection_set()->inc_head());

 592 }
 593 
 594 bool G1HeapVerifier::verify_no_bits_over_tams(const char* bitmap_name, G1CMBitMapRO* bitmap,
 595                                                HeapWord* tams, HeapWord* end) {
 596   guarantee(tams <= end,
 597             "tams: " PTR_FORMAT " end: " PTR_FORMAT, p2i(tams), p2i(end));
 598   HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
 599   if (result < end) {
 600     log_error(gc, verify)("## wrong marked address on %s bitmap: " PTR_FORMAT, bitmap_name, p2i(result));
 601     log_error(gc, verify)("## %s tams: " PTR_FORMAT " end: " PTR_FORMAT, bitmap_name, p2i(tams), p2i(end));
 602     return false;
 603   }
 604   return true;
 605 }
 606 
 607 bool G1HeapVerifier::verify_bitmaps(const char* caller, HeapRegion* hr) {
 608   G1CMBitMapRO* prev_bitmap = _g1h->concurrent_mark()->prevMarkBitMap();
 609   G1CMBitMapRO* next_bitmap = (G1CMBitMapRO*) _g1h->concurrent_mark()->nextMarkBitMap();
 610 
 611   HeapWord* bottom = hr->bottom();




 563   ct_bs->verify_not_dirty_region(mr);
 564 }
 565 
 566 void G1HeapVerifier::verify_dirty_region(HeapRegion* hr) {
 567   // We cannot guarantee that [bottom(),end()] is dirty.  Threads
 568   // dirty allocated blocks as they allocate them. The thread that
 569   // retires each region and replaces it with a new one will do a
 570   // maximal allocation to fill in [pre_dummy_top(),end()] but will
 571   // not dirty that area (one less thing to have to do while holding
 572   // a lock). So we can only verify that [bottom(),pre_dummy_top()]
 573   // is dirty.
 574   G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set();
 575   MemRegion mr(hr->bottom(), hr->pre_dummy_top());
 576   if (hr->is_young()) {
 577     ct_bs->verify_g1_young_region(mr);
 578   } else {
 579     ct_bs->verify_dirty_region(mr);
 580   }
 581 }
 582 
 583 class G1VerifyDirtyYoungListClosure : public HeapRegionClosure {
 584 private:
 585   G1HeapVerifier* _verifier;
 586 public:
 587   G1VerifyDirtyYoungListClosure(G1HeapVerifier* verifier) : HeapRegionClosure(), _verifier(verifier) { }
 588   virtual bool doHeapRegion(HeapRegion* r) {
 589     _verifier->verify_dirty_region(r);
 590     return false;
 591   }
 592 };
 593 
 594 void G1HeapVerifier::verify_dirty_young_regions() {
 595   G1VerifyDirtyYoungListClosure cl(this);
 596   _g1h->collection_set()->iterate(&cl);
 597 }
 598 
 599 bool G1HeapVerifier::verify_no_bits_over_tams(const char* bitmap_name, G1CMBitMapRO* bitmap,
 600                                                HeapWord* tams, HeapWord* end) {
 601   guarantee(tams <= end,
 602             "tams: " PTR_FORMAT " end: " PTR_FORMAT, p2i(tams), p2i(end));
 603   HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
 604   if (result < end) {
 605     log_error(gc, verify)("## wrong marked address on %s bitmap: " PTR_FORMAT, bitmap_name, p2i(result));
 606     log_error(gc, verify)("## %s tams: " PTR_FORMAT " end: " PTR_FORMAT, bitmap_name, p2i(tams), p2i(end));
 607     return false;
 608   }
 609   return true;
 610 }
 611 
 612 bool G1HeapVerifier::verify_bitmaps(const char* caller, HeapRegion* hr) {
 613   G1CMBitMapRO* prev_bitmap = _g1h->concurrent_mark()->prevMarkBitMap();
 614   G1CMBitMapRO* next_bitmap = (G1CMBitMapRO*) _g1h->concurrent_mark()->nextMarkBitMap();
 615 
 616   HeapWord* bottom = hr->bottom();


< prev index next >