src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page
rev 6927 : 8054808: Bitmap verification sometimes fails after Full GC aborts concurrent mark.
Summary: The verification code that checked whether no bitmap mark had been found re-read HeapRegion::end() after the check on the bitmap. Concurrent humongous object allocation could have changed HeapRegion::end() in the meantime. Fix this by using the actual end of the region instead of HeapRegion::end() for comparison.
Reviewed-by:


 871 
 872   // Clear the liveness counting data. If the marking has been aborted, the abort()
 873   // call already did that.
 874   if (cl.complete()) {
 875     clear_all_count_data();
 876   }
 877 
 878   // Repeat the asserts from above.
 879   guarantee(cmThread()->during_cycle(), "invariant");
 880   guarantee(!g1h->mark_in_progress(), "invariant");
 881 }
 882 
 883 class CheckBitmapClearHRClosure : public HeapRegionClosure {
 884   CMBitMap* _bitmap;
 885   bool _error;
 886  public:
 887   CheckBitmapClearHRClosure(CMBitMap* bitmap) : _bitmap(bitmap) {
 888   }
 889 
 890   virtual bool doHeapRegion(HeapRegion* r) {
 891     return _bitmap->getNextMarkedWordAddress(r->bottom(), r->end()) != r->end();




 892   }
 893 };
 894 
 895 bool ConcurrentMark::nextMarkBitmapIsClear() {
 896   CheckBitmapClearHRClosure cl(_nextMarkBitMap);
 897   _g1h->heap_region_iterate(&cl);
 898   return cl.complete();
 899 }
 900 
 901 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
 902 public:
 903   bool doHeapRegion(HeapRegion* r) {
 904     if (!r->continuesHumongous()) {
 905       r->note_start_of_marking();
 906     }
 907     return false;
 908   }
 909 };
 910 
 911 void ConcurrentMark::checkpointRootsInitialPre() {




 871 
 872   // Clear the liveness counting data. If the marking has been aborted, the abort()
 873   // call already did that.
 874   if (cl.complete()) {
 875     clear_all_count_data();
 876   }
 877 
 878   // Repeat the asserts from above.
 879   guarantee(cmThread()->during_cycle(), "invariant");
 880   guarantee(!g1h->mark_in_progress(), "invariant");
 881 }
 882 
 883 class CheckBitmapClearHRClosure : public HeapRegionClosure {
 884   CMBitMap* _bitmap;
 885   bool _error;
 886  public:
 887   CheckBitmapClearHRClosure(CMBitMap* bitmap) : _bitmap(bitmap) {
 888   }
 889 
 890   virtual bool doHeapRegion(HeapRegion* r) {
 891     HeapWord* end = r->bottom() + HeapRegion::GrainWords;
 892     // There cannot be a race when comparing to "end" after the call even if the
 893     // compiler duplicates the calculation of "end" because r->bottom() is always
 894     // constant.
 895     return _bitmap->getNextMarkedWordAddress(r->bottom(), end) != end;
 896   }
 897 };
 898 
 899 bool ConcurrentMark::nextMarkBitmapIsClear() {
 900   CheckBitmapClearHRClosure cl(_nextMarkBitMap);
 901   _g1h->heap_region_iterate(&cl);
 902   return cl.complete();
 903 }
 904 
 905 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
 906 public:
 907   bool doHeapRegion(HeapRegion* r) {
 908     if (!r->continuesHumongous()) {
 909       r->note_start_of_marking();
 910     }
 911     return false;
 912   }
 913 };
 914 
 915 void ConcurrentMark::checkpointRootsInitialPre() {