diff src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20298:83ea089a5c64

8051973: Eager reclaim leaves marks of marked but reclaimed objects on the next bitmap Summary: Eager reclaim also needs to clear marks of eagerly reclaimed regions if they have already been marked during concurrent mark. Reviewed-by: jmasa
author tschatzl
date Thu, 31 Jul 2014 09:23:24 +0200
parents a3953c777565
children c3c9eee55fce
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Jul 29 10:26:09 2014 +0200
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jul 31 09:23:24 2014 +0200
@@ -6578,6 +6578,9 @@
 
     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
+    oop obj = (oop)r->bottom();
+    CMBitMap* next_bitmap = g1h->concurrent_mark()->nextMarkBitMap();
+
     // The following checks whether the humongous object is live are sufficient.
     // The main additional check (in addition to having a reference from the roots
     // or the young gen) is whether the humongous object has a remembered set entry.
@@ -6614,37 +6617,41 @@
         g1h->humongous_region_is_always_live(region_idx)) {
 
       if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
-        gclog_or_tty->print_cr("Live humongous %d region %d with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is dead-bitmap %d live-other %d obj array %d",
+        gclog_or_tty->print_cr("Live humongous %d region %d with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
                                r->isHumongous(),
                                region_idx,
                                r->rem_set()->occupied(),
                                r->rem_set()->strong_code_roots_list_length(),
-                               g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(),
+                               next_bitmap->isMarked(r->bottom()),
                                g1h->humongous_is_live(region_idx),
-                               oop(r->bottom())->is_objArray()
+                               obj->is_objArray()
                               );
       }
 
       return false;
     }
 
-    guarantee(!((oop)(r->bottom()))->is_objArray(),
+    guarantee(!obj->is_objArray(),
               err_msg("Eagerly reclaiming object arrays is not supported, but the object "PTR_FORMAT" is.",
                       r->bottom()));
 
     if (G1TraceReclaimDeadHumongousObjectsAtYoungGC) {
-      gclog_or_tty->print_cr("Reclaim humongous region %d start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is dead-bitmap %d live-other %d obj array %d",
+      gclog_or_tty->print_cr("Reclaim humongous region %d start "PTR_FORMAT" region %d length "UINT32_FORMAT" with remset "SIZE_FORMAT" code roots "SIZE_FORMAT" is marked %d live-other %d obj array %d",
                              r->isHumongous(),
                              r->bottom(),
                              region_idx,
                              r->region_num(),
                              r->rem_set()->occupied(),
                              r->rem_set()->strong_code_roots_list_length(),
-                             g1h->mark_in_progress() && !g1h->g1_policy()->during_initial_mark_pause(),
+                             next_bitmap->isMarked(r->bottom()),
                              g1h->humongous_is_live(region_idx),
-                             oop(r->bottom())->is_objArray()
+                             obj->is_objArray()
                             );
     }
+    // Need to clear mark bit of the humongous object if already set.
+    if (next_bitmap->isMarked(r->bottom())) {
+      next_bitmap->clear(r->bottom());
+    }
     _freed_bytes += r->used();
     r->set_containing_set(NULL);
     _humongous_regions_removed.increment(1u, r->capacity());