# HG changeset patch # Parent 3903388e5ae9647a368e05a35e11ab1c654e9054 diff --git a/src/hotspot/share/gc/z/zDriver.cpp b/src/hotspot/share/gc/z/zDriver.cpp --- a/src/hotspot/share/gc/z/zDriver.cpp +++ b/src/hotspot/share/gc/z/zDriver.cpp @@ -336,8 +336,7 @@ // Phase 2: Concurrent Mark { ZStatTimer timer(ZPhaseConcurrentMark); - ZHeap::heap()->mark_concurrent_roots(); - ZHeap::heap()->mark(); + ZHeap::heap()->mark(true /* initial */); } // Phase 3: Pause Mark End @@ -346,7 +345,7 @@ while (!vm_operation(&cl)) { // Phase 3.5: Concurrent Mark Continue ZStatTimer timer(ZPhaseConcurrentMarkContinue); - ZHeap::heap()->mark(); + ZHeap::heap()->mark(false /* initial */); } } diff --git a/src/hotspot/share/gc/z/zHeap.cpp b/src/hotspot/share/gc/z/zHeap.cpp --- a/src/hotspot/share/gc/z/zHeap.cpp +++ b/src/hotspot/share/gc/z/zHeap.cpp @@ -296,12 +296,8 @@ ZStatHeap::set_at_mark_start(capacity(), used()); } -void ZHeap::mark_concurrent_roots() { - _mark.mark_concurrent_roots(); -} - -void ZHeap::mark() { - _mark.mark(); +void ZHeap::mark(bool initial) { + _mark.mark(initial); } void ZHeap::mark_flush_and_free(Thread* thread) { diff --git a/src/hotspot/share/gc/z/zHeap.hpp b/src/hotspot/share/gc/z/zHeap.hpp --- a/src/hotspot/share/gc/z/zHeap.hpp +++ b/src/hotspot/share/gc/z/zHeap.hpp @@ -133,8 +133,7 @@ bool is_object_strongly_live(uintptr_t addr) const; template void mark_object(uintptr_t addr); void mark_start(); - void mark_concurrent_roots(); - void mark(); + void mark(bool initial); void mark_flush_and_free(Thread* thread); bool mark_end(); diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -140,24 +140,6 @@ } }; -class ZMarkConcurrentRootsTask : public ZTask { -private: - ZMark* const _mark; - ZConcurrentRootsIterator _roots; - -public: - ZMarkConcurrentRootsTask(ZMark* mark) : - ZTask("ZMarkConcurrentRootsTask"), - _mark(mark), - _roots() {} - - virtual void work() { - ZMarkBarrierOopClosure cl; - _roots.oops_do(&cl); - } -}; - - void ZMark::start() { // Verification if (ZVerifyMarking) { @@ -172,11 +154,6 @@ _workers->run_parallel(&task); } -void ZMark::mark_concurrent_roots() { - ZMarkConcurrentRootsTask task(this); - _workers->run_concurrent(&task); -} - void ZMark::prepare_work() { assert(_nworkers == _workers->nconcurrent(), "Invalid number of workers"); @@ -605,6 +582,23 @@ stacks->free(&_allocator); } +class ZMarkConcurrentRootsTask : public ZTask { +private: + ZMark* const _mark; + ZConcurrentRootsIterator _roots; + +public: + ZMarkConcurrentRootsTask(ZMark* mark) : + ZTask("ZMarkConcurrentRootsTask"), + _mark(mark), + _roots() {} + + virtual void work() { + ZMarkBarrierOopClosure cl; + _roots.oops_do(&cl); + } +}; + class ZMarkTask : public ZTask { private: ZMark* const _mark; @@ -627,7 +621,12 @@ } }; -void ZMark::mark() { +void ZMark::mark(bool initial) { + if (initial) { + ZMarkConcurrentRootsTask task(this); + _workers->run_concurrent(&task); + } + ZMarkTask task(this); _workers->run_concurrent(&task); } diff --git a/src/hotspot/share/gc/z/zMark.hpp b/src/hotspot/share/gc/z/zMark.hpp --- a/src/hotspot/share/gc/z/zMark.hpp +++ b/src/hotspot/share/gc/z/zMark.hpp @@ -108,8 +108,7 @@ template void mark_object(uintptr_t addr); void start(); - void mark_concurrent_roots(); - void mark(); + void mark(bool initial); bool end(); void flush_and_free(); diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -235,8 +235,8 @@ } } -ZConcurrentRootsIterator::ZConcurrentRootsIterator() - : _jni_handles_iter(JNIHandles::global_handles()), +ZConcurrentRootsIterator::ZConcurrentRootsIterator() : + _jni_handles_iter(JNIHandles::global_handles()), _jni_handles(this), _class_loader_data_graph(this) { ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);