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

Print this page
rev 4801 : imported patch code-movement
rev 4802 : imported patch optimize-nmethod-scanning
rev 4803 : imported patch thomas-comments-2

@@ -1174,28 +1174,27 @@
 public:
   PostMCRemSetClearClosure(G1CollectedHeap* g1h, ModRefBarrierSet* mr_bs) :
     _g1h(g1h), _mr_bs(mr_bs) {}
 
   bool doHeapRegion(HeapRegion* r) {
+    HeapRegionRemSet* hrrs = r->rem_set();
+
     if (r->continuesHumongous()) {
       // We'll assert that the strong code root list is empty
-      assert(r->strong_code_root_list()->is_empty(), "sanity");
+      assert(hrrs->strong_code_roots_list_length() == 0, "sanity");
       return false;
     }
+
     _g1h->reset_gc_time_stamps(r);
-    HeapRegionRemSet* hrrs = r->rem_set();
-    if (hrrs != NULL) hrrs->clear();
+    hrrs->clear();
     // You might think here that we could clear just the cards
     // corresponding to the used region.  But no: if we leave a dirty card
     // in a region we might allocate into, then it would prevent that card
     // from being enqueued, and cause it to be missed.
     // Re: the performance cost: we shouldn't be doing full GC anyway!
     _mr_bs->clear(MemRegion(r->bottom(), r->end()));
 
-    // We'll also clear the strong code root list for this region
-    r->strong_code_root_list()->clear();
-
     return false;
   }
 };
 
 void G1CollectedHeap::clear_rsets_post_compaction() {

@@ -3105,13 +3104,14 @@
     if (!oopDesc::is_null(heap_oop)) {
       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       
       // Now fetch the region containing the object
       HeapRegion* hr = _g1h->heap_region_containing(obj);
+      HeapRegionRemSet* hrrs = hr->rem_set();
       // Verify that the strong code root list for this region
       // contains the nmethod
-      if (!hr->strong_code_root_list()->contains(_nm)) {
+      if (!hrrs->strong_code_roots_list_contains(_nm)) {
         gclog_or_tty->print_cr("Code root location "PTR_FORMAT" "
                               "from nmethod "PTR_FORMAT" not in strong "
                               "code roots for region ["PTR_FORMAT","PTR_FORMAT")",
                               p, _nm, hr->bottom(), hr->end());
         _failures = true;

@@ -6556,11 +6556,11 @@
 
       // HeapRegion::add_strong_code_root() avoids adding duplicate
       // entries but having duplicates is  OK since we "mark" nmethods
       // as visited when we scan the strong code root lists during the GC.
       hr->add_strong_code_root(_nm);
-      assert(hr->strong_code_root_list()->contains(_nm), "push failed?");
+      assert(hr->rem_set()->strong_code_roots_list_contains(_nm), "add failed?");
     }
   }
 
 public:
   RegisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :

@@ -6579,11 +6579,11 @@
     if (!oopDesc::is_null(heap_oop)) {
       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       HeapRegion* hr = _g1h->heap_region_containing(obj);
       assert(!hr->isHumongous(), "code root in humongous region?");
       hr->remove_strong_code_root(_nm);
-      assert(!hr->strong_code_root_list()->contains(_nm), "remove failed?");
+      assert(!hr->rem_set()->strong_code_roots_list_contains(_nm), "remove failed?");
     }
   }
 
 public:
   UnregisterNMethodOopClosure(G1CollectedHeap* g1h, nmethod* nm) :

@@ -6685,13 +6685,14 @@
 public:
   MarkStrongCodeRootsHRClosure(G1CollectedHeap* g1h, uint worker_id) :
     _g1h(g1h), _worker_id(worker_id) {}
 
   bool doHeapRegion(HeapRegion *hr) {
+    HeapRegionRemSet* hrrs = hr->rem_set();
     if (hr->isHumongous()) {
       // Code roots should never be attached to a humongous region
-      assert(hr->strong_code_root_list()->is_empty(), "sanity");
+      assert(hrrs->strong_code_roots_list_length() == 0, "sanity");
       return false;
     }
 
     if (hr->in_collection_set()) {
       // Don't mark code roots into regions in the collection set here.