< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahTaskqueue.cpp

Print this page
rev 10668 : [backport] Cleanup buffered queue handling
rev 10706 : [backport] Make Shenandoah to use ShenandoahOWST only
rev 10715 : [backport] Cleanup up superfluous newlines
rev 10717 : Fix force termination detection by spin master
rev 10731 : [backport] Force termination logic is inverted
rev 10772 : [backport] Update copyrights

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Red Hat, Inc. and/or its affiliates.
+ * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.
  *

@@ -30,17 +30,14 @@
 void ShenandoahObjToScanQueueSet::clear() {
   uint size = GenericTaskQueueSet<ShenandoahObjToScanQueue, mtGC>::size();
   for (uint index = 0; index < size; index ++) {
     ShenandoahObjToScanQueue* q = queue(index);
     assert(q != NULL, "Sanity");
-    q->set_empty();
-    q->overflow_stack()->clear();
-    q->clear_buffer();
+    q->clear();
   }
 }
 
-
 bool ShenandoahObjToScanQueueSet::is_empty() {
   uint size = GenericTaskQueueSet<ShenandoahObjToScanQueue, mtGC>::size();
   for (uint index = 0; index < size; index ++) {
     ShenandoahObjToScanQueue* q = queue(index);
     assert(q != NULL, "Sanity");

@@ -49,11 +46,11 @@
     }
   }
   return true;
 }
 
-bool ShenandoahTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
+bool ShenandoahTaskTerminator::offer_termination(ShenandoahTerminatorTerminator* terminator) {
   assert(_n_threads > 0, "Initialization is incorrect");
   assert(_offered_termination < _n_threads, "Invariant");
   assert(_blocker != NULL, "Invariant");
 
   // single worker, done

@@ -89,12 +86,13 @@
         _blocker->unlock();
         return true;
       }
     }
 
-    if (((terminator == NULL || terminator->should_force_termination()) && peek_in_queue_set()) ||
-      (terminator != NULL && terminator->should_exit_termination())) {
+    bool force = (terminator != NULL) && terminator->should_force_termination();
+    bool exit  = (terminator != NULL) && terminator->should_exit_termination();
+    if ((!force && peek_in_queue_set()) || exit) {
       _offered_termination --;
       _blocker->unlock();
       return false;
     }
   }

@@ -133,12 +131,11 @@
     queue(i)->stats.reset();
   }
 }
 #endif // TASKQUEUE_STATS
 
-
-bool ShenandoahTaskTerminator::do_spin_master_work(TerminatorTerminator* terminator) {
+bool ShenandoahTaskTerminator::do_spin_master_work(ShenandoahTerminatorTerminator* terminator) {
   uint yield_count = 0;
   // Number of hard spin loops done since last yield
   uint hard_spin_count = 0;
   // Number of iterations in the hard spin loop.
   uint hard_spin_limit = WorkStealingHardSpins;
< prev index next >