8263832: Shenandoah: Fixing parallel thread iteration in final mark task

Reviewed-by: rkennke
This commit is contained in:
Zhengyu Gu 2021-03-19 00:20:18 +00:00
parent 434a399bea
commit d185655c27

View File

@ -96,16 +96,13 @@ class ShenandoahSATBAndRemarkThreadsClosure : public ThreadClosure {
private: private:
SATBMarkQueueSet& _satb_qset; SATBMarkQueueSet& _satb_qset;
OopClosure* const _cl; OopClosure* const _cl;
uintx _claim_token;
public: public:
ShenandoahSATBAndRemarkThreadsClosure(SATBMarkQueueSet& satb_qset, OopClosure* cl) : ShenandoahSATBAndRemarkThreadsClosure(SATBMarkQueueSet& satb_qset, OopClosure* cl) :
_satb_qset(satb_qset), _satb_qset(satb_qset),
_cl(cl), _cl(cl) {}
_claim_token(Threads::thread_claim_token()) {}
void do_thread(Thread* thread) { void do_thread(Thread* thread) {
if (thread->claim_threads_do(true, _claim_token)) {
// Transfer any partial buffer to the qset for completed buffer processing. // Transfer any partial buffer to the qset for completed buffer processing.
_satb_qset.flush_queue(ShenandoahThreadLocalData::satb_mark_queue(thread)); _satb_qset.flush_queue(ShenandoahThreadLocalData::satb_mark_queue(thread));
if (thread->is_Java_thread()) { if (thread->is_Java_thread()) {
@ -115,7 +112,6 @@ public:
} }
} }
} }
}
}; };
class ShenandoahFinalMarkingTask : public AbstractGangTask { class ShenandoahFinalMarkingTask : public AbstractGangTask {
@ -147,7 +143,7 @@ public:
ShenandoahMarkRefsClosure mark_cl(q, rp); ShenandoahMarkRefsClosure mark_cl(q, rp);
ShenandoahSATBAndRemarkThreadsClosure tc(satb_mq_set, ShenandoahSATBAndRemarkThreadsClosure tc(satb_mq_set,
ShenandoahIUBarrier ? &mark_cl : NULL); ShenandoahIUBarrier ? &mark_cl : NULL);
Threads::threads_do(&tc); Threads::possibly_parallel_threads_do(true /*par*/, &tc);
} }
_cm->mark_loop(worker_id, _terminator, rp, _cm->mark_loop(worker_id, _terminator, rp,