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

Print this page
rev 4702 : 8015244: G1: Verification after a full GC is incorrectly placed.
Summary: In a full GC, move the verification after the GC to after RSet rebuilding. Verify RSet entries during a full GC under control of a flag.
Reviewed-by:


 122           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 123           HeapRegion* to   = _g1h->heap_region_containing((HeapWord*)obj);
 124           gclog_or_tty->print_cr("Field "PTR_FORMAT
 125                                  " of live obj "PTR_FORMAT" in region "
 126                                  "["PTR_FORMAT", "PTR_FORMAT")",
 127                                  p, (void*) _containing_obj,
 128                                  from->bottom(), from->end());
 129           print_object(gclog_or_tty, _containing_obj);
 130           gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region "
 131                                  "["PTR_FORMAT", "PTR_FORMAT")",
 132                                  (void*) obj, to->bottom(), to->end());
 133           print_object(gclog_or_tty, obj);
 134         }
 135         gclog_or_tty->print_cr("----------");
 136         gclog_or_tty->flush();
 137         _failures = true;
 138         failed = true;
 139         _n_failures++;
 140       }
 141 
 142       if (!_g1h->full_collection()) {
 143         HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 144         HeapRegion* to   = _g1h->heap_region_containing(obj);
 145         if (from != NULL && to != NULL &&
 146             from != to &&
 147             !to->isHumongous()) {
 148           jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
 149           jbyte cv_field = *_bs->byte_for_const(p);
 150           const jbyte dirty = CardTableModRefBS::dirty_card_val();
 151 
 152           bool is_bad = !(from->is_young()
 153                           || to->rem_set()->contains_reference(p)
 154                           || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed
 155                               (_containing_obj->is_objArray() ?
 156                                   cv_field == dirty
 157                                : cv_obj == dirty || cv_field == dirty));
 158           if (is_bad) {
 159             MutexLockerEx x(ParGCRareEvent_lock,
 160                             Mutex::_no_safepoint_check_flag);
 161 
 162             if (!_failures) {




 122           HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 123           HeapRegion* to   = _g1h->heap_region_containing((HeapWord*)obj);
 124           gclog_or_tty->print_cr("Field "PTR_FORMAT
 125                                  " of live obj "PTR_FORMAT" in region "
 126                                  "["PTR_FORMAT", "PTR_FORMAT")",
 127                                  p, (void*) _containing_obj,
 128                                  from->bottom(), from->end());
 129           print_object(gclog_or_tty, _containing_obj);
 130           gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region "
 131                                  "["PTR_FORMAT", "PTR_FORMAT")",
 132                                  (void*) obj, to->bottom(), to->end());
 133           print_object(gclog_or_tty, obj);
 134         }
 135         gclog_or_tty->print_cr("----------");
 136         gclog_or_tty->flush();
 137         _failures = true;
 138         failed = true;
 139         _n_failures++;
 140       }
 141 
 142       if (!_g1h->full_collection() || G1VerifyRSetsDuringFullGC) {
 143         HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
 144         HeapRegion* to   = _g1h->heap_region_containing(obj);
 145         if (from != NULL && to != NULL &&
 146             from != to &&
 147             !to->isHumongous()) {
 148           jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
 149           jbyte cv_field = *_bs->byte_for_const(p);
 150           const jbyte dirty = CardTableModRefBS::dirty_card_val();
 151 
 152           bool is_bad = !(from->is_young()
 153                           || to->rem_set()->contains_reference(p)
 154                           || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed
 155                               (_containing_obj->is_objArray() ?
 156                                   cv_field == dirty
 157                                : cv_obj == dirty || cv_field == dirty));
 158           if (is_bad) {
 159             MutexLockerEx x(ParGCRareEvent_lock,
 160                             Mutex::_no_safepoint_check_flag);
 161 
 162             if (!_failures) {