@@ -494,61 +494,54 @@ class G1VerificationClosure : public BasicOopIterateClosure {
494
494
};
495
495
496
496
class VerifyLiveClosure : public G1VerificationClosure {
497
- public:
498
- VerifyLiveClosure (G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {}
499
- virtual void do_oop (narrowOop* p) { do_oop_work (p); }
500
- virtual void do_oop (oop* p) { do_oop_work (p); }
501
497
502
498
template <class T >
503
499
void do_oop_work (T* p) {
504
500
assert (_containing_obj != NULL , " Precondition" );
505
501
assert (!_g1h->is_obj_dead_cond (_containing_obj, _vo),
506
502
" Precondition" );
507
- verify_liveness (p);
508
- }
509
503
510
- template <class T >
511
- void verify_liveness (T* p) {
512
504
T heap_oop = RawAccess<>::oop_load (p);
513
- Log (gc, verify) log ;
514
- if (!CompressedOops::is_null (heap_oop)) {
515
- oop obj = CompressedOops::decode_not_null (heap_oop);
516
- bool failed = false ;
517
- bool is_in_heap = _g1h->is_in (obj);
518
- if (!is_in_heap || _g1h->is_obj_dead_cond (obj, _vo)) {
519
- MutexLocker x (ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
505
+ if (CompressedOops::is_null (heap_oop)) {
506
+ return ;
507
+ }
520
508
521
- if (!_failures) {
522
- log .error (" ----------" );
523
- }
524
- ResourceMark rm;
525
- if (!is_in_heap) {
526
- HeapRegion* from = _g1h->heap_region_containing (p);
527
- log .error (" Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
528
- p2i (p), p2i (_containing_obj), HR_FORMAT_PARAMS (from));
529
- LogStream ls (log .error ());
530
- print_object (&ls, _containing_obj);
531
- HeapRegion* const to = _g1h->heap_region_containing (obj);
532
- log .error (" points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s" ,
533
- p2i (obj), HR_FORMAT_PARAMS (to), to->rem_set ()->get_state_str ());
534
- } else {
535
- HeapRegion* from = _g1h->heap_region_containing (p);
536
- HeapRegion* to = _g1h->heap_region_containing (obj);
537
- log .error (" Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
538
- p2i (p), p2i (_containing_obj), HR_FORMAT_PARAMS (from));
539
- LogStream ls (log .error ());
540
- print_object (&ls, _containing_obj);
541
- log .error (" points to dead obj " PTR_FORMAT " in region " HR_FORMAT,
542
- p2i (obj), HR_FORMAT_PARAMS (to));
543
- print_object (&ls, obj);
544
- }
509
+ oop obj = CompressedOops::decode_raw_not_null (heap_oop);
510
+ bool is_in_heap = _g1h->is_in (obj);
511
+ if (!is_in_heap || _g1h->is_obj_dead_cond (obj, _vo)) {
512
+ MutexLocker x (ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
513
+
514
+ Log (gc, verify) log ;
515
+ if (!_failures) {
545
516
log .error (" ----------" );
546
- _failures = true ;
547
- failed = true ;
548
- _n_failures++;
549
517
}
518
+ ResourceMark rm;
519
+
520
+ HeapRegion* from = _g1h->heap_region_containing (p);
521
+ log .error (" Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT,
522
+ p2i (p), p2i (_containing_obj), HR_FORMAT_PARAMS (from));
523
+ LogStream ls (log .error ());
524
+ print_object (&ls, _containing_obj);
525
+
526
+ if (!is_in_heap) {
527
+ log .error (" points to address " PTR_FORMAT " outside of heap" , p2i (obj));
528
+ } else {
529
+ HeapRegion* to = _g1h->heap_region_containing (obj);
530
+ log .error (" points to dead obj " PTR_FORMAT " in region " HR_FORMAT " remset %s" ,
531
+ p2i (obj), HR_FORMAT_PARAMS (to), to->rem_set ()->get_state_str ());
532
+ print_object (&ls, obj);
533
+ }
534
+ log .error (" ----------" );
535
+ _failures = true ;
536
+ _n_failures++;
550
537
}
551
538
}
539
+
540
+ public:
541
+ VerifyLiveClosure (G1CollectedHeap* g1h, VerifyOption vo) : G1VerificationClosure(g1h, vo) {}
542
+
543
+ virtual void do_oop (narrowOop* p) { do_oop_work (p); }
544
+ virtual void do_oop (oop* p) { do_oop_work (p); }
552
545
};
553
546
554
547
class VerifyRemSetClosure : public G1VerificationClosure {
0 commit comments