changeset 49861:b0c100aaede6

8201826: G1: Don't invoke WeakProcessor if mark stack has overflowed Summary: Move WeakProcessor invocation after overflow check Reviewed-by: stefank, tschatzl
author kbarrett
date Mon, 23 Apr 2018 16:00:56 -0400
parents ca5216a2a2cc
children 14b48f47528b
files src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Mon Apr 23 14:51:16 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Mon Apr 23 16:00:56 2018 -0400
@@ -1695,21 +1695,18 @@
     assert(!rp->discovery_enabled(), "Post condition");
   }
 
-  assert(has_overflown() || _global_mark_stack.is_empty(),
-         "Mark stack should be empty (unless it has overflown)");
+  if (has_overflown()) {
+    // We can not trust g1_is_alive if the marking stack overflowed
+    return;
+  }
+
+  assert(_global_mark_stack.is_empty(), "Marking should have completed");
 
   {
     GCTraceTime(Debug, gc, phases) debug("Weak Processing", _gc_timer_cm);
     WeakProcessor::weak_oops_do(&g1_is_alive, &do_nothing_cl);
   }
 
-  if (has_overflown()) {
-    // We can not trust g1_is_alive if the marking stack overflowed
-    return;
-  }
-
-  assert(_global_mark_stack.is_empty(), "Marking should have completed");
-
   // Unload Klasses, String, Symbols, Code Cache, etc.
   if (ClassUnloadingWithConcurrentMark) {
     GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm);