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,23 +96,19 @@ class ShenandoahSATBAndRemarkThreadsClosure : public ThreadClosure {
private:
SATBMarkQueueSet& _satb_qset;
OopClosure* const _cl;
uintx _claim_token;
public:
ShenandoahSATBAndRemarkThreadsClosure(SATBMarkQueueSet& satb_qset, OopClosure* cl) :
_satb_qset(satb_qset),
_cl(cl),
_claim_token(Threads::thread_claim_token()) {}
_cl(cl) {}
void do_thread(Thread* thread) {
if (thread->claim_threads_do(true, _claim_token)) {
// Transfer any partial buffer to the qset for completed buffer processing.
_satb_qset.flush_queue(ShenandoahThreadLocalData::satb_mark_queue(thread));
if (thread->is_Java_thread()) {
if (_cl != NULL) {
ResourceMark rm;
thread->oops_do(_cl, NULL);
}
// Transfer any partial buffer to the qset for completed buffer processing.
_satb_qset.flush_queue(ShenandoahThreadLocalData::satb_mark_queue(thread));
if (thread->is_Java_thread()) {
if (_cl != NULL) {
ResourceMark rm;
thread->oops_do(_cl, NULL);
}
}
}
@ -147,7 +143,7 @@ public:
ShenandoahMarkRefsClosure mark_cl(q, rp);
ShenandoahSATBAndRemarkThreadsClosure tc(satb_mq_set,
ShenandoahIUBarrier ? &mark_cl : NULL);
Threads::threads_do(&tc);
Threads::possibly_parallel_threads_do(true /*par*/, &tc);
}
_cm->mark_loop(worker_id, _terminator, rp,