File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
src/hotspot/share/gc/parallel Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,8 @@ void PSPromotionManager::restore_preserved_marks() {
227227}
228228
229229void PSPromotionManager::drain_stacks_depth (bool totally_drain) {
230- totally_drain = totally_drain || (_target_stack_size == 0 );
230+ const uint threshold = totally_drain ? 0
231+ : _target_stack_size;
231232
232233 PSScannerTasksQueue* const tq = claimed_stack_depth ();
233234 do {
@@ -236,19 +237,15 @@ void PSPromotionManager::drain_stacks_depth(bool totally_drain) {
236237 // Drain overflow stack first, so other threads can steal from
237238 // claimed stack while we work.
238239 while (tq->pop_overflow (task)) {
239- process_popped_location_depth (task);
240- }
241-
242- if (totally_drain) {
243- while (tq->pop_local (task)) {
244- process_popped_location_depth (task);
245- }
246- } else {
247- while (tq->size () > _target_stack_size && tq->pop_local (task)) {
240+ if (!tq->try_push_to_taskqueue (task)) {
248241 process_popped_location_depth (task);
249242 }
250243 }
251- } while ((totally_drain && !tq->taskqueue_empty ()) || !tq->overflow_empty ());
244+
245+ while (tq->pop_local (task, threshold)) {
246+ process_popped_location_depth (task);
247+ }
248+ } while (!tq->overflow_empty ());
252249
253250 assert (!totally_drain || tq->taskqueue_empty (), " Sanity" );
254251 assert (totally_drain || tq->size () <= _target_stack_size, " Sanity" );
You can’t perform that action at this time.
0 commit comments