--- old/src/hotspot/share/gc/z/zRootsIterator.cpp 2020-06-23 10:06:47.136652351 +0200 +++ new/src/hotspot/share/gc/z/zRootsIterator.cpp 2020-06-23 10:06:46.964646351 +0200 @@ -30,7 +30,7 @@ #include "gc/shared/barrierSetNMethod.hpp" #include "gc/shared/oopStorageSet.hpp" #include "gc/shared/oopStorageParState.inline.hpp" -#include "gc/shared/oopStorageSet.hpp" +#include "gc/shared/oopStorageSetParState.inline.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zBarrierSetNMethod.hpp" #include "gc/z/zGlobals.hpp" @@ -70,8 +70,7 @@ static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup"); static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots"); static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown"); -static const ZStatSubPhase ZSubPhaseConcurrentRootsJNIHandles("Concurrent Roots JNIHandles"); -static const ZStatSubPhase ZSubPhaseConcurrentRootsVMHandles("Concurrent Roots VMHandles"); +static const ZStatSubPhase ZSubPhaseConcurrentRootsOopStorageSet("Concurrent Roots OopStorageSet"); static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph"); static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup"); @@ -286,11 +285,9 @@ } ZConcurrentRootsIterator::ZConcurrentRootsIterator(int cld_claim) : - _jni_handles_iter(OopStorageSet::jni_global()), - _vm_handles_iter(OopStorageSet::vm_global()), + _oop_storage_set_iter(), _cld_claim(cld_claim), - _jni_handles(this), - _vm_handles(this), + _oop_storage_set(this), _class_loader_data_graph(this) { ZStatTimer timer(ZSubPhaseConcurrentRootsSetup); ClassLoaderDataGraph::clear_claimed_marks(cld_claim); @@ -300,14 +297,9 @@ ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown); } -void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) { - ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles); - _jni_handles_iter.oops_do(cl); -} - -void ZConcurrentRootsIterator::do_vm_handles(ZRootsIteratorClosure* cl) { - ZStatTimer timer(ZSubPhaseConcurrentRootsVMHandles); - _vm_handles_iter.oops_do(cl); +void ZConcurrentRootsIterator::do_oop_storage_set(ZRootsIteratorClosure* cl) { + ZStatTimer timer(ZSubPhaseConcurrentRootsOopStorageSet); + _oop_storage_set_iter.oops_do(cl); } void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) { @@ -318,8 +310,7 @@ void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhaseConcurrentRoots); - _jni_handles.oops_do(cl); - _vm_handles.oops_do(cl), + _oop_storage_set.oops_do(cl); _class_loader_data_graph.oops_do(cl); } --- old/src/hotspot/share/gc/z/zRootsIterator.hpp 2020-06-23 10:06:47.452663372 +0200 +++ new/src/hotspot/share/gc/z/zRootsIterator.hpp 2020-06-23 10:06:47.296657930 +0200 @@ -25,6 +25,7 @@ #define SHARE_GC_Z_ZROOTSITERATOR_HPP #include "gc/shared/oopStorageParState.hpp" +#include "gc/shared/oopStorageSetParState.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" @@ -35,6 +36,7 @@ class ZRootsIteratorClosure; typedef OopStorage::ParState ZOopStorageIterator; +typedef OopStorageSetStrongParState ZOopStorageSetIterator; template class ZSerialOopsDo { @@ -134,16 +136,13 @@ class ZConcurrentRootsIterator { private: - ZOopStorageIterator _jni_handles_iter; - ZOopStorageIterator _vm_handles_iter; - const int _cld_claim; + ZOopStorageSetIterator _oop_storage_set_iter; + const int _cld_claim; - void do_jni_handles(ZRootsIteratorClosure* cl); - void do_vm_handles(ZRootsIteratorClosure* cl); + void do_oop_storage_set(ZRootsIteratorClosure* cl); void do_class_loader_data_graph(ZRootsIteratorClosure* cl); - ZParallelOopsDo _jni_handles; - ZParallelOopsDo _vm_handles; + ZParallelOopsDo _oop_storage_set; ZParallelOopsDo _class_loader_data_graph; public: --- /dev/null 2020-06-11 14:40:13.671999880 +0200 +++ new/src/hotspot/share/gc/shared/oopStorageSetParState.hpp 2020-06-23 10:06:47.608668812 +0200 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP +#define SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP + +#include "gc/shared/oopStorageParState.hpp" + +template +class OopStorageSetStrongParState { +private: + typedef OopStorage::ParState ParStateType; + + ParStateType* _par_states; + + static ParStateType* allocate(); + static void deallocate(ParStateType* iter_set); + +public: + OopStorageSetStrongParState(); + ~OopStorageSetStrongParState(); + + template + void oops_do(Closure* cl); +}; + +#endif // SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_HPP --- /dev/null 2020-06-11 14:40:13.671999880 +0200 +++ new/src/hotspot/share/gc/shared/oopStorageSetParState.inline.hpp 2020-06-23 10:06:47.960681088 +0200 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP +#define SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP + +#include "gc/shared/oopStorageParState.inline.hpp" +#include "gc/shared/oopStorageSet.hpp" +#include "gc/shared/oopStorageSetParState.hpp" + +template +typename OopStorageSetStrongParState::ParStateType* OopStorageSetStrongParState::allocate() { + return MallocArrayAllocator::allocate(OopStorageSet::strong_count, mtGC); +} + +template +void OopStorageSetStrongParState::deallocate(ParStateType* iter_set) { + MallocArrayAllocator::free(iter_set); +} + +template +OopStorageSetStrongParState::OopStorageSetStrongParState() : + _par_states(allocate()) { + int counter = 0; + for (OopStorageSet::Iterator it = OopStorageSet::strong_iterator(); !it.is_end(); ++it) { + new (&_par_states[counter++]) ParStateType(*it); + } +} + +template +OopStorageSetStrongParState::~OopStorageSetStrongParState() { + int counter = 0; + for (OopStorageSet::Iterator it = OopStorageSet::strong_iterator(); !it.is_end(); ++it) { + _par_states[counter++].~ParStateType(); + } + + deallocate(_par_states); +} + +template +template +void OopStorageSetStrongParState::oops_do(Closure* cl) { + for (size_t i = 0; i < OopStorageSet::strong_count; i++) { + _par_states[i].oops_do(cl); + } +} + + +#endif // SHARE_GC_SHARED_OOPSTORAGESETPARSTATE_INLINE_HPP +