src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp
changeset 57955 18863bf3501f
parent 57953 d78c910f9069
child 57969 6f0215981777
--- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp	Thu Aug 29 15:50:45 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp	Thu Aug 29 18:52:30 2019 -0400
@@ -80,7 +80,7 @@
   }
 }
 
-G1DirtyCardQueueSet::G1DirtyCardQueueSet(bool notify_when_complete) :
+G1DirtyCardQueueSet::G1DirtyCardQueueSet() :
   PtrQueueSet(),
   _cbl_mon(NULL),
   _completed_buffers_head(NULL),
@@ -88,7 +88,6 @@
   _num_cards(0),
   _process_cards_threshold(ProcessCardsThresholdNever),
   _process_completed_buffers(false),
-  _notify_when_complete(notify_when_complete),
   _max_cards(MaxCardsUnlimited),
   _max_cards_padding(0),
   _free_ids(NULL),
@@ -124,7 +123,7 @@
 }
 
 void G1DirtyCardQueueSet::enqueue_completed_buffer(BufferNode* cbn) {
-  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(_cbl_mon, Mutex::_no_safepoint_check_flag);
   cbn->set_next(NULL);
   if (_completed_buffers_tail == NULL) {
     assert(_completed_buffers_head == NULL, "Well-formedness");
@@ -139,9 +138,7 @@
   if (!process_completed_buffers() &&
       (num_cards() > process_cards_threshold())) {
     set_process_completed_buffers(true);
-    if (_notify_when_complete) {
-      _cbl_mon->notify_all();
-    }
+    ml.notify_all();
   }
   verify_num_cards();
 }
@@ -203,11 +200,10 @@
 }
 
 void G1DirtyCardQueueSet::notify_if_necessary() {
-  MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
+  MonitorLocker ml(_cbl_mon, Mutex::_no_safepoint_check_flag);
   if (num_cards() > process_cards_threshold()) {
     set_process_completed_buffers(true);
-    if (_notify_when_complete)
-      _cbl_mon->notify();
+    ml.notify_all();
   }
 }