562 verify_remembered_set(p);
563 }
564
565 template <class T>
566 void verify_remembered_set(T* p) {
567 T heap_oop = oopDesc::load_heap_oop(p);
568 Log(gc, verify) log;
569 if (!oopDesc::is_null(heap_oop)) {
570 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
571 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
572 HeapRegion* to = _g1h->heap_region_containing(obj);
573 if (from != NULL && to != NULL &&
574 from != to &&
575 !to->is_pinned()) {
576 jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
577 jbyte cv_field = *_bs->byte_for_const(p);
578 const jbyte dirty = CardTableModRefBS::dirty_card_val();
579
580 bool is_bad = !(from->is_young()
581 || to->rem_set()->contains_reference(p)
582 || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed
583 (_containing_obj->is_objArray() ?
584 cv_field == dirty
585 : cv_obj == dirty || cv_field == dirty));
586 if (is_bad) {
587 MutexLockerEx x(ParGCRareEvent_lock,
588 Mutex::_no_safepoint_check_flag);
589
590 if (!_failures) {
591 log.error("----------");
592 }
593 log.error("Missing rem set entry:");
594 log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
595 p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
596 ResourceMark rm;
597 _containing_obj->print_on(log.error_stream());
598 log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
599 if (obj->is_oop()) {
600 obj->print_on(log.error_stream());
601 }
602 log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
603 log.error("----------");
604 _failures = true;
605 _n_failures++;
|
562 verify_remembered_set(p);
563 }
564
565 template <class T>
566 void verify_remembered_set(T* p) {
567 T heap_oop = oopDesc::load_heap_oop(p);
568 Log(gc, verify) log;
569 if (!oopDesc::is_null(heap_oop)) {
570 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
571 HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p);
572 HeapRegion* to = _g1h->heap_region_containing(obj);
573 if (from != NULL && to != NULL &&
574 from != to &&
575 !to->is_pinned()) {
576 jbyte cv_obj = *_bs->byte_for_const(_containing_obj);
577 jbyte cv_field = *_bs->byte_for_const(p);
578 const jbyte dirty = CardTableModRefBS::dirty_card_val();
579
580 bool is_bad = !(from->is_young()
581 || to->rem_set()->contains_reference(p)
582 || (_containing_obj->is_objArray() ?
583 cv_field == dirty :
584 cv_obj == dirty || cv_field == dirty));
585 if (is_bad) {
586 MutexLockerEx x(ParGCRareEvent_lock,
587 Mutex::_no_safepoint_check_flag);
588
589 if (!_failures) {
590 log.error("----------");
591 }
592 log.error("Missing rem set entry:");
593 log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT,
594 p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from));
595 ResourceMark rm;
596 _containing_obj->print_on(log.error_stream());
597 log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT, p2i(obj), HR_FORMAT_PARAMS(to));
598 if (obj->is_oop()) {
599 obj->print_on(log.error_stream());
600 }
601 log.error("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field);
602 log.error("----------");
603 _failures = true;
604 _n_failures++;
|