8368989: Use NMethodMarkingScope and ThreadsClaimTokenScope in shenandoahSTWMark

Reviewed-by: shade, ayang
This commit is contained in:
Francesco Andreuzzi 2025-10-02 18:49:00 +00:00 committed by Paul Hohensee
parent 3d113af9e3
commit 1d55adee11

View File

@ -24,8 +24,7 @@
*/
#include "gc/shared/strongRootsScope.hpp"
#include "code/nmethod.hpp"
#include "gc/shared/taskTerminator.hpp"
#include "gc/shared/workerThread.hpp"
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
@ -36,10 +35,13 @@
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
#include "gc/shenandoah/shenandoahSTWMark.hpp"
#include "gc/shenandoah/shenandoahVerifier.hpp"
#include "runtime/threads.hpp"
class ShenandoahSTWMarkTask : public WorkerTask {
private:
ShenandoahSTWMark* const _mark;
NMethodMarkingScope _nmethod_marking_scope;
ThreadsClaimTokenScope _threads_claim_token_scope;
public:
ShenandoahSTWMarkTask(ShenandoahSTWMark* mark);
@ -48,7 +50,9 @@ public:
ShenandoahSTWMarkTask::ShenandoahSTWMarkTask(ShenandoahSTWMark* mark) :
WorkerTask("Shenandoah STW mark"),
_mark(mark) {
_mark(mark),
_nmethod_marking_scope(),
_threads_claim_token_scope() {
}
void ShenandoahSTWMarkTask::work(uint worker_id) {
@ -98,7 +102,6 @@ void ShenandoahSTWMark::mark() {
_generation->scan_remembered_set(false /* is_concurrent */);
}
StrongRootsScope scope(nworkers);
ShenandoahSTWMarkTask task(this);
heap->workers()->run_task(&task);