diff src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 22724:2d21c13d7829

Add logic to verify HeapRegionRemSet when running G1
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 05 Nov 2015 15:18:36 -0800
parents 7baf47cb97cb
children dd9cc155639c
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Thu Nov 05 15:17:36 2015 -0800
+++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Thu Nov 05 15:18:36 2015 -0800
@@ -858,6 +858,22 @@
   guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
 }
 
+class VerifyNoZombies : public CodeBlobClosure {
+private:
+  HeapRegionRemSet* _rem_set;
+public:
+  VerifyNoZombies(HeapRegionRemSet* rem_set) : _rem_set(rem_set) {}
+  void do_code_blob(CodeBlob* blob) {
+    guarantee(blob->as_nmethod_or_null()->is_alive(), err_msg("zombie nmethod %d " INTPTR_FORMAT " " INTPTR_FORMAT " in remembered set",
+              blob->as_nmethod_or_null()->compile_id(), blob, _rem_set));
+  }
+};
+
+void HeapRegionRemSet::verify() {
+  VerifyNoZombies blk(this);
+  _code_roots.nmethods_do(&blk);
+}
+
 bool HeapRegionRemSet::claim_iter() {
   if (_iter_state != Unclaimed) return false;
   jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_state), Unclaimed);