diff src/share/vm/gc_implementation/g1/g1Allocator.cpp @ 22897:80ac3ee51955

8065358: Refactor G1s usage of save_marks and reduce related races Summary: Stop using save_marks in G1 related code and make setting the replacement field less racy. Reviewed-by: brutisso, tschatzl
author mgerdin
date Wed, 25 Mar 2015 11:03:16 +0100
parents 227a9e5e4b4a
children c132be0fb74d
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Tue Mar 24 10:04:10 2015 +0000
+++ b/src/share/vm/gc_implementation/g1/g1Allocator.cpp	Wed Mar 25 11:03:16 2015 +0100
@@ -59,7 +59,7 @@
       !(retained_region->top() == retained_region->end()) &&
       !retained_region->is_empty() &&
       !retained_region->isHumongous()) {
-    retained_region->record_top_and_timestamp();
+    retained_region->record_timestamp();
     // The retained region was added to the old region set when it was
     // retired. We have to remove it now, since we don't allow regions
     // we allocate to in the region sets. We'll re-add it later, when
@@ -94,6 +94,9 @@
   // want either way so no reason to check explicitly for either
   // condition.
   _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
+  if (_retained_old_gc_alloc_region != NULL) {
+    _retained_old_gc_alloc_region->record_retained_region();
+  }
 
   if (ResizePLAB) {
     _g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);