From 06e47d05b646b99894cc57a1a26e295d1dbabe8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Fri, 5 Jun 2020 15:22:53 +0200 Subject: [PATCH] 8246622: Remove CollectedHeap::print_gc_threads_on() Reviewed-by: stefank, tschatzl, sjohanss --- src/hotspot/share/gc/epsilon/epsilonHeap.hpp | 1 - src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 12 -------- src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 1 - src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 4 --- src/hotspot/share/gc/g1/g1ConcurrentMark.hpp | 1 - .../share/gc/g1/g1ConcurrentRefine.cpp | 13 --------- .../share/gc/g1/g1ConcurrentRefine.hpp | 3 -- .../gc/parallel/parallelScavengeHeap.cpp | 4 --- .../gc/parallel/parallelScavengeHeap.hpp | 3 +- src/hotspot/share/gc/shared/collectedHeap.hpp | 7 ----- .../share/gc/shared/genCollectedHeap.cpp | 3 -- .../share/gc/shared/genCollectedHeap.hpp | 3 +- .../gc/shared/stringdedup/stringDedup.cpp | 8 +----- .../gc/shared/stringdedup/stringDedup.hpp | 4 +-- src/hotspot/share/gc/shared/workgroup.cpp | 10 +------ src/hotspot/share/gc/shared/workgroup.hpp | 6 ---- .../share/gc/shenandoah/shenandoahHeap.cpp | 7 ----- .../share/gc/shenandoah/shenandoahHeap.hpp | 1 - src/hotspot/share/gc/z/zCollectedHeap.cpp | 13 --------- src/hotspot/share/gc/z/zCollectedHeap.hpp | 1 - src/hotspot/share/gc/z/zHeap.cpp | 4 --- src/hotspot/share/gc/z/zHeap.hpp | 3 +- src/hotspot/share/gc/z/zRuntimeWorkers.cpp | 6 +--- src/hotspot/share/gc/z/zRuntimeWorkers.hpp | 3 +- src/hotspot/share/gc/z/zWorkers.cpp | 6 +--- src/hotspot/share/gc/z/zWorkers.hpp | 3 +- src/hotspot/share/runtime/thread.cpp | 28 +++++++++++++------ 27 files changed, 31 insertions(+), 127 deletions(-) diff --git a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp index db22ea7186d..8cf9c97187a 100644 --- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp @@ -117,7 +117,6 @@ class EpsilonHeap : public CollectedHeap { bool block_is_obj(const HeapWord* addr) const { return false; } // No GC threads - virtual void print_gc_threads_on(outputStream* st) const {} virtual void gc_threads_do(ThreadClosure* tc) const {} // No nmethod handling diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index ae31e6de20e..0ec15986e63 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -2567,18 +2567,6 @@ void G1CollectedHeap::print_on_error(outputStream* st) const { } } -void G1CollectedHeap::print_gc_threads_on(outputStream* st) const { - workers()->print_worker_threads_on(st); - _cm_thread->print_on(st); - st->cr(); - _cm->print_worker_threads_on(st); - _cr->print_threads_on(st); - _young_gen_sampling_thread->print_on(st); - if (G1StringDedup::is_enabled()) { - G1StringDedup::print_worker_threads_on(st); - } -} - void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { workers()->threads_do(tc); tc->do_thread(_cm_thread); diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 4dba3e066d1..71f89d09184 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -1454,7 +1454,6 @@ class G1CollectedHeap : public CollectedHeap { virtual void print_extended_on(outputStream* st) const; virtual void print_on_error(outputStream* st) const; - virtual void print_gc_threads_on(outputStream* st) const; virtual void gc_threads_do(ThreadClosure* tc) const; // Override diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 0a371228b6a..46234bcaf43 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -2026,10 +2026,6 @@ void G1ConcurrentMark::print_summary_info() { cm_thread()->vtime_accum(), cm_thread()->vtime_mark_accum()); } -void G1ConcurrentMark::print_worker_threads_on(outputStream* st) const { - _concurrent_workers->print_worker_threads_on(st); -} - void G1ConcurrentMark::threads_do(ThreadClosure* tc) const { _concurrent_workers->threads_do(tc); } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index 39421ad5267..e37179e2710 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -583,7 +583,6 @@ class G1ConcurrentMark : public CHeapObj { void print_summary_info(); - void print_worker_threads_on(outputStream* st) const; void threads_do(ThreadClosure* tc) const; void print_on_error(outputStream* st) const; diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp index 2607f48a127..b8bd67eb07a 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp @@ -114,15 +114,6 @@ void G1ConcurrentRefineThreadControl::maybe_activate_next(uint cur_worker_id) { } } -void G1ConcurrentRefineThreadControl::print_on(outputStream* st) const { - for (uint i = 0; i < _num_max_threads; ++i) { - if (_threads[i] != NULL) { - _threads[i]->print_on(st); - st->cr(); - } - } -} - void G1ConcurrentRefineThreadControl::worker_threads_do(ThreadClosure* tc) { for (uint i = 0; i < _num_max_threads; i++) { if (_threads[i] != NULL) { @@ -318,10 +309,6 @@ uint G1ConcurrentRefine::max_num_threads() { return G1ConcRefinementThreads; } -void G1ConcurrentRefine::print_threads_on(outputStream* st) const { - _thread_control.print_on(st); -} - static size_t calc_new_green_zone(size_t green, double logged_cards_scan_time, size_t processed_logged_cards, diff --git a/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp b/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp index 3f32a5c3199..b904e47a76a 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp @@ -57,7 +57,6 @@ class G1ConcurrentRefineThreadControl { // activate it. void maybe_activate_next(uint cur_worker_id); - void print_on(outputStream* st) const; void worker_threads_do(ThreadClosure* tc); void stop(); }; @@ -139,8 +138,6 @@ class G1ConcurrentRefine : public CHeapObj { // Maximum number of refinement threads. static uint max_num_threads(); - void print_threads_on(outputStream* st) const; - // Cards in the dirty card queue set. size_t green_zone() const { return _green_zone; } size_t yellow_zone() const { return _yellow_zone; } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index f970efcab67..2ed42c16f0e 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -615,10 +615,6 @@ void ParallelScavengeHeap::gc_threads_do(ThreadClosure* tc) const { ParallelScavengeHeap::heap()->workers().threads_do(tc); } -void ParallelScavengeHeap::print_gc_threads_on(outputStream* st) const { - ParallelScavengeHeap::heap()->workers().print_worker_threads_on(st); -} - void ParallelScavengeHeap::print_tracing_info() const { AdaptiveSizePolicyOutput::print(); log_debug(gc, heap, exit)("Accumulated young generation GC time %3.7f secs", PSScavenge::accumulated_time()->seconds()); diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp index 0f818e55f7e..54f4ca72b73 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -217,7 +217,6 @@ class ParallelScavengeHeap : public CollectedHeap { PSHeapSummary create_ps_heap_summary(); virtual void print_on(outputStream* st) const; virtual void print_on_error(outputStream* st) const; - virtual void print_gc_threads_on(outputStream* st) const; virtual void gc_threads_do(ThreadClosure* tc) const; virtual void print_tracing_info() const; diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp index e2c625dd1fc..8a6936d2e37 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp @@ -429,13 +429,6 @@ class CollectedHeap : public CHeapObj { // Used to print information about locations in the hs_err file. virtual bool print_location(outputStream* st, void* addr) const = 0; - // Print all GC threads (other than the VM thread) - // used by this heap. - virtual void print_gc_threads_on(outputStream* st) const = 0; - // The default behavior is to call print_gc_threads_on() on tty. - void print_gc_threads() { - print_gc_threads_on(tty); - } // Iterator for all GC threads (other than VM thread) virtual void gc_threads_do(ThreadClosure* tc) const = 0; diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.cpp b/src/hotspot/share/gc/shared/genCollectedHeap.cpp index 53622190181..fbae5f614e5 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp @@ -1237,9 +1237,6 @@ void GenCollectedHeap::print_on(outputStream* st) const { void GenCollectedHeap::gc_threads_do(ThreadClosure* tc) const { } -void GenCollectedHeap::print_gc_threads_on(outputStream* st) const { -} - bool GenCollectedHeap::print_location(outputStream* st, void* addr) const { return BlockLocationPrinter::print_location(st, addr); } diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.hpp b/src/hotspot/share/gc/shared/genCollectedHeap.hpp index 835413f63b7..283399a243f 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -331,7 +331,6 @@ class GenCollectedHeap : public CollectedHeap { // Override. virtual void print_on(outputStream* st) const; - virtual void print_gc_threads_on(outputStream* st) const; virtual void gc_threads_do(ThreadClosure* tc) const; virtual void print_tracing_info() const; diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp b/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp index c10902cb7dc..6b7f31091e3 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,12 +65,6 @@ void StringDedup::threads_do(ThreadClosure* tc) { tc->do_thread(StringDedupThread::thread()); } -void StringDedup::print_worker_threads_on(outputStream* st) { - assert(is_enabled(), "String deduplication not enabled"); - StringDedupThread::thread()->print_on(st); - st->cr(); -} - void StringDedup::verify() { assert(is_enabled(), "String deduplication not enabled"); StringDedupQueue::verify(); diff --git a/src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp b/src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp index eb79ec79c15..7a3ccd92c67 100644 --- a/src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp +++ b/src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ class StringDedup : public AllStatic { static void parallel_unlink(StringDedupUnlinkOrOopsDoClosure* unlink, uint worker_id); static void threads_do(ThreadClosure* tc); - static void print_worker_threads_on(outputStream* st); + static void verify(); // GC support diff --git a/src/hotspot/share/gc/shared/workgroup.cpp b/src/hotspot/share/gc/shared/workgroup.cpp index e457301f6bf..bbed81b70dc 100644 --- a/src/hotspot/share/gc/shared/workgroup.cpp +++ b/src/hotspot/share/gc/shared/workgroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,14 +86,6 @@ AbstractGangWorker* AbstractWorkGang::worker(uint i) const { return result; } -void AbstractWorkGang::print_worker_threads_on(outputStream* st) const { - uint workers = created_workers(); - for (uint i = 0; i < workers; i++) { - worker(i)->print_on(st); - st->cr(); - } -} - void AbstractWorkGang::threads_do(ThreadClosure* tc) const { assert(tc != NULL, "Null ThreadClosure"); uint workers = created_workers(); diff --git a/src/hotspot/share/gc/shared/workgroup.hpp b/src/hotspot/share/gc/shared/workgroup.hpp index 260a556ac02..6cc63bd4589 100644 --- a/src/hotspot/share/gc/shared/workgroup.hpp +++ b/src/hotspot/share/gc/shared/workgroup.hpp @@ -188,12 +188,6 @@ class AbstractWorkGang : public CHeapObj { // Debugging. const char* name() const { return _name; } - // Printing - void print_worker_threads_on(outputStream *st) const; - void print_worker_threads() const { - print_worker_threads_on(tty); - } - protected: virtual AbstractGangWorker* allocate_worker(uint which) = 0; }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 34685762dcc..56a898895ab 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1178,13 +1178,6 @@ void ShenandoahHeap::prepare_for_verify() { } } -void ShenandoahHeap::print_gc_threads_on(outputStream* st) const { - workers()->print_worker_threads_on(st); - if (ShenandoahStringDedup::is_enabled()) { - ShenandoahStringDedup::print_worker_threads_on(st); - } -} - void ShenandoahHeap::gc_threads_do(ThreadClosure* tcl) const { workers()->threads_do(tcl); if (_safepoint_workers != NULL) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index c1139c14b41..0657e73be9a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -160,7 +160,6 @@ class ShenandoahHeap : public CollectedHeap { void print_on(outputStream* st) const; void print_extended_on(outputStream *st) const; void print_tracing_info() const; - void print_gc_threads_on(outputStream* st) const; void print_heap_regions_on(outputStream* st) const; void stop(); diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index d269e0fa9f4..e7418bc9aaa 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -329,19 +329,6 @@ void ZCollectedHeap::print_extended_on(outputStream* st) const { _heap.print_extended_on(st); } -void ZCollectedHeap::print_gc_threads_on(outputStream* st) const { - _director->print_on(st); - st->cr(); - _driver->print_on(st); - st->cr(); - _uncommitter->print_on(st); - st->cr(); - _stat->print_on(st); - st->cr(); - _heap.print_worker_threads_on(st); - _runtime_workers.print_threads_on(st); -} - void ZCollectedHeap::print_tracing_info() const { // Does nothing } diff --git a/src/hotspot/share/gc/z/zCollectedHeap.hpp b/src/hotspot/share/gc/z/zCollectedHeap.hpp index a0a887fb90a..06c55ca8a4b 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.hpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp @@ -120,7 +120,6 @@ class ZCollectedHeap : public CollectedHeap { virtual void print_on(outputStream* st) const; virtual void print_on_error(outputStream* st) const; virtual void print_extended_on(outputStream* st) const; - virtual void print_gc_threads_on(outputStream* st) const; virtual void print_tracing_info() const; virtual bool print_location(outputStream* st, void* addr) const; diff --git a/src/hotspot/share/gc/z/zHeap.cpp b/src/hotspot/share/gc/z/zHeap.cpp index 1d08f15d71b..674f5d0a56c 100644 --- a/src/hotspot/share/gc/z/zHeap.cpp +++ b/src/hotspot/share/gc/z/zHeap.cpp @@ -202,10 +202,6 @@ void ZHeap::worker_threads_do(ThreadClosure* tc) const { _workers.threads_do(tc); } -void ZHeap::print_worker_threads_on(outputStream* st) const { - _workers.print_threads_on(st); -} - void ZHeap::out_of_memory() { ResourceMark rm; diff --git a/src/hotspot/share/gc/z/zHeap.hpp b/src/hotspot/share/gc/z/zHeap.hpp index 0b91ef7d9fa..580d2567d33 100644 --- a/src/hotspot/share/gc/z/zHeap.hpp +++ b/src/hotspot/share/gc/z/zHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,6 @@ class ZHeap { uint nconcurrent_no_boost_worker_threads() const; void set_boost_worker_threads(bool boost); void worker_threads_do(ThreadClosure* tc) const; - void print_worker_threads_on(outputStream* st) const; // Reference processing ReferenceDiscoverer* reference_discoverer(); diff --git a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp index d40858a0838..e6f375a18f4 100644 --- a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp +++ b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,3 @@ WorkGang* ZRuntimeWorkers::workers() { void ZRuntimeWorkers::threads_do(ThreadClosure* tc) const { _workers.threads_do(tc); } - -void ZRuntimeWorkers::print_threads_on(outputStream* st) const { - _workers.print_worker_threads_on(st); -} diff --git a/src/hotspot/share/gc/z/zRuntimeWorkers.hpp b/src/hotspot/share/gc/z/zRuntimeWorkers.hpp index a201c79fa23..54115c3c85f 100644 --- a/src/hotspot/share/gc/z/zRuntimeWorkers.hpp +++ b/src/hotspot/share/gc/z/zRuntimeWorkers.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ class ZRuntimeWorkers { WorkGang* workers(); void threads_do(ThreadClosure* tc) const; - void print_threads_on(outputStream* st) const; }; #endif // SHARE_GC_Z_ZRUNTIMEWORKERS_HPP diff --git a/src/hotspot/share/gc/z/zWorkers.cpp b/src/hotspot/share/gc/z/zWorkers.cpp index ea7240efaf7..128b43a0a24 100644 --- a/src/hotspot/share/gc/z/zWorkers.cpp +++ b/src/hotspot/share/gc/z/zWorkers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,3 @@ void ZWorkers::run_concurrent(ZTask* task) { void ZWorkers::threads_do(ThreadClosure* tc) const { _workers.threads_do(tc); } - -void ZWorkers::print_threads_on(outputStream* st) const { - _workers.print_worker_threads_on(st); -} diff --git a/src/hotspot/share/gc/z/zWorkers.hpp b/src/hotspot/share/gc/z/zWorkers.hpp index 329a1a21c42..c677a438c6c 100644 --- a/src/hotspot/share/gc/z/zWorkers.hpp +++ b/src/hotspot/share/gc/z/zWorkers.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,6 @@ class ZWorkers { void run_concurrent(ZTask* task); void threads_do(ThreadClosure* tc) const; - void print_threads_on(outputStream* st) const; }; #endif // SHARE_GC_Z_ZWORKERS_HPP diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index d5826b5d0da..6f68708aeb3 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -4736,6 +4736,22 @@ JavaThread *Threads::owning_thread_from_monitor_owner(ThreadsList * t_list, return the_owner; } +class PrintOnClosure : public ThreadClosure { +private: + outputStream* _st; + +public: + PrintOnClosure(outputStream* st) : + _st(st) {} + + virtual void do_thread(Thread* thread) { + if (thread != NULL) { + thread->print_on(_st); + _st->cr(); + } + } +}; + // Threads::print_on() is called at safepoint by VM_PrintThreads operation. void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, @@ -4778,14 +4794,10 @@ void Threads::print_on(outputStream* st, bool print_stacks, #endif // INCLUDE_SERVICES } - VMThread::vm_thread()->print_on(st); - st->cr(); - Universe::heap()->print_gc_threads_on(st); - WatcherThread* wt = WatcherThread::watcher_thread(); - if (wt != NULL) { - wt->print_on(st); - st->cr(); - } + PrintOnClosure cl(st); + cl.do_thread(VMThread::vm_thread()); + Universe::heap()->gc_threads_do(&cl); + cl.do_thread(WatcherThread::watcher_thread()); st->flush(); }