From 9b99bc8ef53ad20c4f1cb5d26cffc64b0deb79ad Mon Sep 17 00:00:00 2001 From: Francesco Andreuzzi Date: Sat, 11 Oct 2025 06:13:13 +0000 Subject: [PATCH] 8369440: Remove RootResolverMarkScope and RootSetClosureMarkScope Reviewed-by: ayang --- .../share/gc/serial/defNewGeneration.cpp | 1 - src/hotspot/share/gc/serial/serialHeap.cpp | 1 - .../share/gc/shared/strongRootsScope.cpp | 36 ------------------- .../share/gc/shared/strongRootsScope.hpp | 36 ------------------- .../leakprofiler/chains/rootSetClosure.cpp | 5 --- .../leakprofiler/checkpoint/rootResolver.cpp | 6 ---- 6 files changed, 85 deletions(-) delete mode 100644 src/hotspot/share/gc/shared/strongRootsScope.cpp delete mode 100644 src/hotspot/share/gc/shared/strongRootsScope.hpp diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 42f8b191f5e..5b7bc744236 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -45,7 +45,6 @@ #include "gc/shared/scavengableNMethods.hpp" #include "gc/shared/space.hpp" #include "gc/shared/spaceDecorator.hpp" -#include "gc/shared/strongRootsScope.hpp" #include "gc/shared/weakProcessor.hpp" #include "logging/log.hpp" #include "memory/iterator.inline.hpp" diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index dbd54c302ea..3442dc4c907 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -56,7 +56,6 @@ #include "gc/shared/oopStorageSet.inline.hpp" #include "gc/shared/scavengableNMethods.hpp" #include "gc/shared/space.hpp" -#include "gc/shared/strongRootsScope.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/shared/weakProcessor.hpp" #include "gc/shared/workerThread.hpp" diff --git a/src/hotspot/share/gc/shared/strongRootsScope.cpp b/src/hotspot/share/gc/shared/strongRootsScope.cpp deleted file mode 100644 index 2130cd5f1c0..00000000000 --- a/src/hotspot/share/gc/shared/strongRootsScope.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015, 2025, 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. - * - */ - -#include "classfile/stringTable.hpp" -#include "code/nmethod.hpp" -#include "gc/shared/strongRootsScope.hpp" -#include "runtime/threads.hpp" - -MarkScope::MarkScope() { - nmethod::oops_do_marking_prologue(); -} - -MarkScope::~MarkScope() { - nmethod::oops_do_marking_epilogue(); -} diff --git a/src/hotspot/share/gc/shared/strongRootsScope.hpp b/src/hotspot/share/gc/shared/strongRootsScope.hpp deleted file mode 100644 index be6cb4b549f..00000000000 --- a/src/hotspot/share/gc/shared/strongRootsScope.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015, 2019, 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_STRONGROOTSSCOPE_HPP -#define SHARE_GC_SHARED_STRONGROOTSSCOPE_HPP - -#include "memory/allocation.hpp" - -class MarkScope : public StackObj { - protected: - MarkScope(); - ~MarkScope(); -}; - -#endif // SHARE_GC_SHARED_STRONGROOTSSCOPE_HPP diff --git a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp index 04ba9477fab..d339568a7f7 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp @@ -26,7 +26,6 @@ #include "classfile/stringTable.hpp" #include "gc/shared/oopStorage.inline.hpp" #include "gc/shared/oopStorageSet.inline.hpp" -#include "gc/shared/strongRootsScope.hpp" #include "jfr/leakprofiler/chains/bfsClosure.hpp" #include "jfr/leakprofiler/chains/dfsClosure.hpp" #include "jfr/leakprofiler/chains/edgeQueue.hpp" @@ -61,8 +60,6 @@ void RootSetClosure::do_oop(narrowOop* ref) { } } -class RootSetClosureMarkScope : public MarkScope {}; - template class RawRootClosure : public OopClosure { Delegate* _delegate; @@ -89,8 +86,6 @@ public: template void RootSetClosure::process() { - RootSetClosureMarkScope mark_scope; - CLDToOopClosure cldt_closure(this, ClassLoaderData::_claim_none); ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure); diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp index 4d7ccba5262..f274939bfe2 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp @@ -26,7 +26,6 @@ #include "classfile/stringTable.hpp" #include "gc/shared/oopStorage.inline.hpp" #include "gc/shared/oopStorageSet.hpp" -#include "gc/shared/strongRootsScope.hpp" #include "jfr/leakprofiler/checkpoint/rootResolver.hpp" #include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp" #include "jfr/utilities/jfrThreadIterator.hpp" @@ -325,12 +324,7 @@ bool ReferenceToThreadRootClosure::do_thread_roots(JavaThread* jt) { return false; } -class RootResolverMarkScope : public MarkScope { -}; - void RootResolver::resolve(RootCallback& callback) { - RootResolverMarkScope mark_scope; - // thread local roots ReferenceToThreadRootClosure rtrc(callback); if (rtrc.complete()) {