Skip to content

Commit

Permalink
8273545: Remove Thread::is_GC_task_thread()
Browse files Browse the repository at this point in the history
  • Loading branch information
pliden committed Sep 9, 2021
1 parent f6cc173 commit ca94d76
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Expand Up @@ -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)) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psParallelCompact.cpp
Expand Up @@ -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()");
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/shared/workgroup.cpp
Expand Up @@ -129,13 +129,12 @@ class GangTaskDispatcher : public CHeapObj<mtGC> {
};
// 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())
{ }
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/gc/shared/workgroup.hpp
Expand Up @@ -95,7 +95,6 @@ class WorkGang : public CHeapObj<mtInternal> {
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.
Expand All @@ -116,14 +115,13 @@ class WorkGang : public CHeapObj<mtInternal> {
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; }
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Expand Up @@ -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.");
Expand All @@ -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();
}
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.hpp
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/z/zCollectedHeap.cpp
Expand Up @@ -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<ConcurrentGCThread*>(thread)->stop();
}
}
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/z/zRuntimeWorkers.cpp
Expand Up @@ -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());
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/z/zWorkers.cpp
Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/runtime/thread.hpp
Expand Up @@ -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; }
Expand Down

0 comments on commit ca94d76

Please sign in to comment.