8214202: DirtyCardQueueSet::get_completed_buffer should not clear _process_completed
authorkbarrett
Mon, 26 Nov 2018 13:17:39 -0500
changeset 52684 e62fe5079d64
parent 52683 e017d2f176d0
child 52685 6d243dcde190
8214202: DirtyCardQueueSet::get_completed_buffer should not clear _process_completed Summary: Remove flag clearing and simplify get_completed-buffer. Reviewed-by: tschatzl, sjohanss
src/hotspot/share/gc/g1/dirtyCardQueue.cpp
src/hotspot/share/gc/shared/ptrQueue.cpp
--- a/src/hotspot/share/gc/g1/dirtyCardQueue.cpp	Mon Nov 26 09:36:30 2018 +0100
+++ b/src/hotspot/share/gc/g1/dirtyCardQueue.cpp	Mon Nov 26 13:17:39 2018 -0500
@@ -221,23 +221,22 @@
 
 
 BufferNode* DirtyCardQueueSet::get_completed_buffer(size_t stop_at) {
-  BufferNode* nd = NULL;
   MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
 
   if (_n_completed_buffers <= stop_at) {
-    _process_completed = false;
     return NULL;
   }
 
-  if (_completed_buffers_head != NULL) {
-    nd = _completed_buffers_head;
-    assert(_n_completed_buffers > 0, "Invariant");
-    _completed_buffers_head = nd->next();
-    _n_completed_buffers--;
-    if (_completed_buffers_head == NULL) {
-      assert(_n_completed_buffers == 0, "Invariant");
-      _completed_buffers_tail = NULL;
-    }
+  assert(_n_completed_buffers > 0, "invariant");
+  assert(_completed_buffers_head != NULL, "invariant");
+  assert(_completed_buffers_tail != NULL, "invariant");
+
+  BufferNode* nd = _completed_buffers_head;
+  _completed_buffers_head = nd->next();
+  _n_completed_buffers--;
+  if (_completed_buffers_head == NULL) {
+    assert(_n_completed_buffers == 0, "Invariant");
+    _completed_buffers_tail = NULL;
   }
   DEBUG_ONLY(assert_completed_buffer_list_len_correct_locked());
   return nd;
--- a/src/hotspot/share/gc/shared/ptrQueue.cpp	Mon Nov 26 09:36:30 2018 +0100
+++ b/src/hotspot/share/gc/shared/ptrQueue.cpp	Mon Nov 26 13:17:39 2018 -0500
@@ -327,7 +327,7 @@
 
 void PtrQueueSet::notify_if_necessary() {
   MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
-  assert(_process_completed_threshold >= 0, "_process_completed is negative");
+  assert(_process_completed_threshold >= 0, "_process_completed_threshold is negative");
   if (_n_completed_buffers >= (size_t)_process_completed_threshold || _max_completed_queue == 0) {
     _process_completed = true;
     if (_notify_when_complete)