From ca94d767bf4c15ba289d6d3f77b064eff13e19d4 Mon Sep 17 00:00:00 2001 From: Per Liden Date: Thu, 9 Sep 2021 14:03:07 +0200 Subject: [PATCH] 8273545: Remove Thread::is_GC_task_thread() --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 1 - src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 2 +- src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp | 1 - src/hotspot/share/gc/parallel/psParallelCompact.cpp | 2 +- src/hotspot/share/gc/shared/workgroup.cpp | 3 +-- src/hotspot/share/gc/shared/workgroup.hpp | 5 +---- src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp | 2 -- src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp | 3 +-- src/hotspot/share/gc/z/zCollectedHeap.cpp | 3 +-- src/hotspot/share/gc/z/zRuntimeWorkers.cpp | 1 - src/hotspot/share/gc/z/zWorkers.cpp | 1 - src/hotspot/share/runtime/thread.hpp | 4 ---- 12 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index c765a7b33c348..cd2d8f2076616 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -1684,7 +1684,6 @@ jint G1CollectedHeap::initialize() { } _workers = new WorkGang("GC Thread", ParallelGCThreads, - true /* are_GC_task_threads */, false /* are_ConcurrentGC_threads */); if (_workers == NULL) { return JNI_ENOMEM; diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 90407b8dce79b..6133e88c4ea53 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -432,7 +432,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, _num_concurrent_workers = ConcGCThreads; _max_concurrent_workers = _num_concurrent_workers; - _concurrent_workers = new WorkGang("G1 Conc", _max_concurrent_workers, false, true); + _concurrent_workers = new WorkGang("G1 Conc", _max_concurrent_workers, true); _concurrent_workers->initialize_workers(); if (!_global_mark_stack.initialize(MarkStackSize, MarkStackSizeMax)) { diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp index a3c92af436ac7..9663aad1bd5f8 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp @@ -120,7 +120,6 @@ class ParallelScavengeHeap : public CollectedHeap { _old_pool(NULL), _workers("GC Thread", ParallelGCThreads, - true /* are_GC_task_threads */, false /* are_ConcurrentGC_threads */) { } // For use by VM operations diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 94eab7f86d6de..1b5137a2ad5a8 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -2145,7 +2145,7 @@ void PCAdjustPointerClosure::verify_cm(ParCompactionManager* cm) { if (Thread::current()->is_VM_thread()) { assert(cm == vmthread_cm, "VM threads should use ParCompactionManager from get_vmthread_cm()"); } else { - assert(Thread::current()->is_GC_task_thread(), "Must be a GC thread"); + assert(Thread::current()->is_Worker_thread(), "Must be a GC thread"); assert(cm != vmthread_cm, "GC threads should use ParCompactionManager from gc_thread_compaction_manager()"); } } diff --git a/src/hotspot/share/gc/shared/workgroup.cpp b/src/hotspot/share/gc/shared/workgroup.cpp index 795c1efebd153..85ce4e5f019bb 100644 --- a/src/hotspot/share/gc/shared/workgroup.cpp +++ b/src/hotspot/share/gc/shared/workgroup.cpp @@ -129,13 +129,12 @@ class GangTaskDispatcher : public CHeapObj { }; // Definitions of WorkGang methods. -WorkGang::WorkGang(const char* name, uint workers, bool are_GC_task_threads, bool are_ConcurrentGC_threads) : +WorkGang::WorkGang(const char* name, uint workers, bool are_ConcurrentGC_threads) : _workers(NULL), _total_workers(workers), _active_workers(UseDynamicNumberOfGCThreads ? 1U : workers), _created_workers(0), _name(name), - _are_GC_task_threads(are_GC_task_threads), _are_ConcurrentGC_threads(are_ConcurrentGC_threads), _dispatcher(new GangTaskDispatcher()) { } diff --git a/src/hotspot/share/gc/shared/workgroup.hpp b/src/hotspot/share/gc/shared/workgroup.hpp index c43cd873ec2d9..b488f016b73c0 100644 --- a/src/hotspot/share/gc/shared/workgroup.hpp +++ b/src/hotspot/share/gc/shared/workgroup.hpp @@ -95,7 +95,6 @@ class WorkGang : public CHeapObj { const char* _name; // Initialize only instance data. - const bool _are_GC_task_threads; const bool _are_ConcurrentGC_threads; // To get access to the GangTaskDispatcher instance. @@ -116,14 +115,13 @@ class WorkGang : public CHeapObj { GangWorker* allocate_worker(uint which); public: - WorkGang(const char* name, uint workers, bool are_GC_task_threads, bool are_ConcurrentGC_threads); + WorkGang(const char* name, uint workers, bool are_ConcurrentGC_threads); ~WorkGang(); // Initialize workers in the gang. Return true if initialization succeeded. void initialize_workers(); - bool are_GC_task_threads() const { return _are_GC_task_threads; } bool are_ConcurrentGC_threads() const { return _are_ConcurrentGC_threads; } uint total_workers() const { return _total_workers; } @@ -217,7 +215,6 @@ class GangWorker: public WorkerThread { GangWorker(WorkGang* gang, uint id); // Predicate for Thread - bool is_GC_task_thread() const override { return gang()->are_GC_task_threads(); } bool is_ConcurrentGC_thread() const override { return gang()->are_ConcurrentGC_threads(); } // Printing diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index c226b9ba21c0c..c6b3747d890e7 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -496,7 +496,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) : _max_workers = MAX2(_max_workers, 1U); _workers = new ShenandoahWorkGang("Shenandoah GC Threads", _max_workers, - /* are_GC_task_threads */ true, /* are_ConcurrentGC_threads */ true); if (_workers == NULL) { vm_exit_during_initialization("Failed necessary allocation."); @@ -507,7 +506,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) : if (ParallelGCThreads > 1) { _safepoint_workers = new ShenandoahWorkGang("Safepoint Cleanup Thread", ParallelGCThreads, - /* are_GC_task_threads */ false, /* are_ConcurrentGC_threads */ false); _safepoint_workers->initialize_workers(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp b/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp index be3bac5cee522..cfd0db019776e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp @@ -57,9 +57,8 @@ class ShenandoahWorkGang : public WorkGang { public: ShenandoahWorkGang(const char* name, uint workers, - bool are_GC_task_threads, bool are_ConcurrentGC_threads) : - WorkGang(name, workers, are_GC_task_threads, are_ConcurrentGC_threads), _initialize_gclab(false) { + WorkGang(name, workers, are_ConcurrentGC_threads), _initialize_gclab(false) { } // Create a GC worker and install it into the work gang. diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index 3ea6e7a9bcb86..2b39fb68fb607 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -80,8 +80,7 @@ void ZCollectedHeap::initialize_serviceability() { class ZStopConcurrentGCThreadClosure : public ThreadClosure { public: virtual void do_thread(Thread* thread) { - if (thread->is_ConcurrentGC_thread() && - !thread->is_GC_task_thread()) { + if (thread->is_ConcurrentGC_thread() && !thread->is_Worker_thread()) { static_cast(thread)->stop(); } } diff --git a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp index 95a7ff74ac64e..4362879813211 100644 --- a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp +++ b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp @@ -60,7 +60,6 @@ class ZRuntimeWorkersInitializeTask : public AbstractGangTask { ZRuntimeWorkers::ZRuntimeWorkers() : _workers("RuntimeWorker", ParallelGCThreads, - false /* are_GC_task_threads */, false /* are_ConcurrentGC_threads */) { log_info_p(gc, init)("Runtime Workers: %u", _workers.total_workers()); diff --git a/src/hotspot/share/gc/z/zWorkers.cpp b/src/hotspot/share/gc/z/zWorkers.cpp index 6240533aa5501..dd26e70c08082 100644 --- a/src/hotspot/share/gc/z/zWorkers.cpp +++ b/src/hotspot/share/gc/z/zWorkers.cpp @@ -64,7 +64,6 @@ class ZWorkersInitializeTask : public AbstractGangTask { ZWorkers::ZWorkers() : _workers("ZWorker", UseDynamicNumberOfGCThreads ? ConcGCThreads : MAX2(ConcGCThreads, ParallelGCThreads), - true /* are_GC_task_threads */, true /* are_ConcurrentGC_threads */) { if (UseDynamicNumberOfGCThreads) { diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 9bc8c94882950..4882d3b453dac 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -334,10 +334,6 @@ class Thread: public ThreadShadow { virtual bool is_monitor_deflation_thread() const { return false; } virtual bool is_hidden_from_external_view() const { return false; } virtual bool is_jvmti_agent_thread() const { return false; } - // True iff the thread can perform GC operations at a safepoint. - // Generally will be true only of VM thread and parallel GC WorkGang - // threads. - virtual bool is_GC_task_thread() const { return false; } virtual bool is_Watcher_thread() const { return false; } virtual bool is_ConcurrentGC_thread() const { return false; } virtual bool is_Named_thread() const { return false; }