src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
changeset 49727 2bbd5117d91a
parent 49672 f1d2b6c0693b
child 49751 c3a10df652c0
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Mon Apr 09 10:09:38 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Tue Apr 10 09:12:23 2018 +0200
@@ -530,13 +530,18 @@
   }
 }
 
+static void clear_mark_if_set(G1CMBitMap* bitmap, HeapWord* addr) {
+  if (bitmap->is_marked(addr)) {
+    bitmap->clear(addr);
+  }
+}
+
 void G1ConcurrentMark::humongous_object_eagerly_reclaimed(HeapRegion* r) {
   assert_at_safepoint_on_vm_thread();
 
-  // Need to clear mark bit of the humongous object.
-  if (_next_mark_bitmap->is_marked(r->bottom())) {
-    _next_mark_bitmap->clear(r->bottom());
-  }
+  // Need to clear all mark bits of the humongous object.
+  clear_mark_if_set(_prev_mark_bitmap, r->bottom());
+  clear_mark_if_set(_next_mark_bitmap, r->bottom());
 
   if (!_g1h->collector_state()->mark_or_rebuild_in_progress()) {
     return;