Skip to content
Permalink
Browse files
8254576: ZGC: Clean up timers in roots iterators
Reviewed-by: eosterlund, stefank
  • Loading branch information
pliden committed Oct 13, 2020
1 parent 508c8a9 commit 5d6a625543ae585862947da91a3cf836e3a4eaab
Showing 2 changed files with 10 additions and 30 deletions.
@@ -55,21 +55,11 @@
#include "utilities/debug.hpp"

static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");

static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
static const ZStatSubPhase ZSubPhaseConcurrentRootsOopStorageSet("Concurrent Roots OopStorageSet");
static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
static const ZStatSubPhase ZSubPhaseConcurrentRootsJavaThreads("Concurrent Roots Java Threads");
static const ZStatSubPhase ZSubPhaseConcurrentRootsJavaThreads("Concurrent Roots JavaThreads");
static const ZStatSubPhase ZSubPhaseConcurrentRootsCodeCache("Concurrent Roots CodeCache");

static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");

static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsOopStorageSet("Concurrent Weak Roots OopStorageSet");

template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
@@ -154,15 +144,13 @@ ZConcurrentRootsIterator::ZConcurrentRootsIterator(int cld_claim) :
_class_loader_data_graph(this),
_java_threads(this),
_code_cache(this) {
ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
ClassLoaderDataGraph::clear_claimed_marks(cld_claim);
if (!ClassUnloading) {
ZNMethodTable::nmethods_do_begin();
}
}

ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
if (!ClassUnloading) {
ZNMethodTable::nmethods_do_end();
}
@@ -179,12 +167,18 @@ void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure*
ClassLoaderDataGraph::always_strong_cld_do(&cld_cl);
}

void ZConcurrentRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhaseConcurrentRootsCodeCache);
ZNMethod::oops_do(cl, cl->should_disarm_nmethods());
}

class ZConcurrentRootsIteratorThreadClosure : public ThreadClosure {
private:
ZRootsIteratorClosure* const _cl;
// The resource mark is needed because interpreter oop maps are not reused in concurrent mode.
// Instead, they are temporary and resource allocated.
// The resource mark is needed because interpreter oop maps are
// not reused in concurrent mode. Instead, they are temporary and
// resource allocated.
ResourceMark _rm;
ZRootsIteratorClosure* const _cl;

public:
ZConcurrentRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) :
@@ -195,19 +189,13 @@ class ZConcurrentRootsIteratorThreadClosure : public ThreadClosure {
}
};

void ZConcurrentRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhaseConcurrentRootsCodeCache);
ZNMethod::oops_do(cl, cl->should_disarm_nmethods());
}

void ZConcurrentRootsIterator::do_java_threads(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhaseConcurrentRootsJavaThreads);
ZConcurrentRootsIteratorThreadClosure thread_cl(cl);
_java_threads_iter.threads_do(&thread_cl);
}

void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhaseConcurrentRoots);
_oop_storage_set.oops_do(cl);
_class_loader_data_graph.oops_do(cl);
_java_threads.oops_do(cl);
@@ -219,11 +207,6 @@ void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
ZWeakRootsIterator::ZWeakRootsIterator() :
_jvmti_weak_export(this) {
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
ZStatTimer timer(ZSubPhasePauseWeakRootsSetup);
}

ZWeakRootsIterator::~ZWeakRootsIterator() {
ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown);
}

void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
@@ -232,7 +215,6 @@ void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRoot
}

void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseWeakRoots);
_jvmti_weak_export.weak_oops_do(is_alive, cl);
}

@@ -256,6 +238,5 @@ void ZConcurrentWeakRootsIterator::do_oop_storage_set(ZRootsIteratorClosure* cl)
}

void ZConcurrentWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhaseConcurrentWeakRoots);
_oop_storage_set.oops_do(cl);
}
@@ -159,7 +159,6 @@ class ZWeakRootsIterator {

public:
ZWeakRootsIterator();
~ZWeakRootsIterator();

void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
void oops_do(ZRootsIteratorClosure* cl);

1 comment on commit 5d6a625

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 5d6a625 Oct 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.