8065402: G1 does not expand marking stack when mark stack overflow happens during concurrent marking
authoraharlap
Tue, 09 May 2017 13:50:06 -0400
changeset 46447 dbb55d89699c
parent 46446 ababb65abf24
child 46448 b5350a83520b
child 46449 7b2416f0f524
8065402: G1 does not expand marking stack when mark stack overflow happens during concurrent marking Summary: Simplified decision mechanism for marking stack expansion Reviewed-by: kbarrett, tschatzl
hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp
hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Tue May 09 11:04:06 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp	Tue May 09 13:50:06 2017 -0400
@@ -135,8 +135,7 @@
 G1CMMarkStack::G1CMMarkStack() :
   _max_chunk_capacity(0),
   _base(NULL),
-  _chunk_capacity(0),
-  _should_expand(false) {
+  _chunk_capacity(0) {
   set_empty();
 }
 
@@ -159,7 +158,6 @@
   _base = new_base;
   _chunk_capacity = new_capacity;
   set_empty();
-  _should_expand = false;
 
   return true;
 }
@@ -188,9 +186,6 @@
 }
 
 void G1CMMarkStack::expand() {
-  // Clear expansion flag
-  _should_expand = false;
-
   if (_chunk_capacity == _max_chunk_capacity) {
     log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of " SIZE_FORMAT " chunks.", _chunk_capacity);
     return;
@@ -590,8 +585,13 @@
 
 
 void G1ConcurrentMark::reset_marking_state() {
-  _global_mark_stack.set_should_expand(has_overflown());
   _global_mark_stack.set_empty();
+
+  // Expand the marking stack, if we have to and if we can.
+  if (has_overflown()) {
+    _global_mark_stack.expand();
+  }
+
   clear_has_overflown();
   _finger = _heap_start;
 
@@ -1156,11 +1156,6 @@
     set_non_marking_state();
   }
 
-  // Expand the marking stack, if we have to and if we can.
-  if (_global_mark_stack.should_expand()) {
-    _global_mark_stack.expand();
-  }
-
   // Statistics
   double now = os::elapsedTime();
   _remark_mark_times.add((mark_work_end - start) * 1000.0);
--- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp	Tue May 09 11:04:06 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp	Tue May 09 13:50:06 2017 -0400
@@ -259,8 +259,6 @@
   TaskQueueEntryChunk* remove_chunk_from_chunk_list();
   TaskQueueEntryChunk* remove_chunk_from_free_list();
 
-  bool  _should_expand;
-
   // Resizes the mark stack to the given new capacity. Releases any previous
   // memory if successful.
   bool resize(size_t new_capacity);
@@ -293,9 +291,6 @@
 
   size_t capacity() const  { return _chunk_capacity; }
 
-  bool should_expand() const { return _should_expand; }
-  void set_should_expand(bool value) { _should_expand = value; }
-
   // Expand the stack, typically in response to an overflow condition
   void expand();