src/hotspot/share/gc/g1/g1HeapVerifier.cpp
changeset 50800 6da12aa23b88
parent 50752 9d62da00bf15
child 51332 c25572739e7c
equal deleted inserted replaced
50799:f9ae777f71ee 50800:6da12aa23b88
   178       guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count());
   178       guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count());
   179     }
   179     }
   180   }
   180   }
   181 };
   181 };
   182 
   182 
   183 class VerifyLivenessOopClosure: public OopClosure {
   183 class VerifyLivenessOopClosure: public BasicOopIterateClosure {
   184   G1CollectedHeap* _g1h;
   184   G1CollectedHeap* _g1h;
   185   VerifyOption _vo;
   185   VerifyOption _vo;
   186 public:
   186 public:
   187   VerifyLivenessOopClosure(G1CollectedHeap* g1h, VerifyOption vo):
   187   VerifyLivenessOopClosure(G1CollectedHeap* g1h, VerifyOption vo):
   188     _g1h(g1h), _vo(vo)
   188     _g1h(g1h), _vo(vo)
   224       // since the last marking.
   224       // since the last marking.
   225       if (_vo == VerifyOption_G1UseFullMarking) {
   225       if (_vo == VerifyOption_G1UseFullMarking) {
   226         guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
   226         guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
   227       }
   227       }
   228 
   228 
   229       o->oop_iterate_no_header(&isLive);
   229       o->oop_iterate(&isLive);
   230       if (!_hr->obj_allocated_since_prev_marking(o)) {
   230       if (!_hr->obj_allocated_since_prev_marking(o)) {
   231         size_t obj_size = o->size();    // Make sure we don't overflow
   231         size_t obj_size = o->size();    // Make sure we don't overflow
   232         _live_bytes += (obj_size * HeapWordSize);
   232         _live_bytes += (obj_size * HeapWordSize);
   233       }
   233       }
   234     }
   234     }
   235   }
   235   }
   236   size_t live_bytes() { return _live_bytes; }
   236   size_t live_bytes() { return _live_bytes; }
   237 };
   237 };
   238 
   238 
   239 class VerifyArchiveOopClosure: public OopClosure {
   239 class VerifyArchiveOopClosure: public BasicOopIterateClosure {
   240   HeapRegion* _hr;
   240   HeapRegion* _hr;
   241 public:
   241 public:
   242   VerifyArchiveOopClosure(HeapRegion *hr)
   242   VerifyArchiveOopClosure(HeapRegion *hr)
   243     : _hr(hr) { }
   243     : _hr(hr) { }
   244   void do_oop(narrowOop *p) { do_oop_work(p); }
   244   void do_oop(narrowOop *p) { do_oop_work(p); }
   267     : _hr(hr) { }
   267     : _hr(hr) { }
   268   // Verify that all object pointers are to archive regions.
   268   // Verify that all object pointers are to archive regions.
   269   void do_object(oop o) {
   269   void do_object(oop o) {
   270     VerifyArchiveOopClosure checkOop(_hr);
   270     VerifyArchiveOopClosure checkOop(_hr);
   271     assert(o != NULL, "Should not be here for NULL oops");
   271     assert(o != NULL, "Should not be here for NULL oops");
   272     o->oop_iterate_no_header(&checkOop);
   272     o->oop_iterate(&checkOop);
   273   }
   273   }
   274 };
   274 };
   275 
   275 
   276 // Should be only used at CDS dump time
   276 // Should be only used at CDS dump time
   277 class VerifyArchivePointerRegionClosure: public HeapRegionClosure {
   277 class VerifyArchivePointerRegionClosure: public HeapRegionClosure {