From 4ab274ac1a241b2d63f46084ec23aa7cff4bc28e Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 7 Oct 2021 15:24:00 +0000 Subject: [PATCH] 8274858: Remove unused dictionary_classes_do functions Reviewed-by: dholmes, hseigel --- .../share/classfile/classLoaderDataGraph.cpp | 17 +---------------- .../share/classfile/classLoaderDataGraph.hpp | 7 ------- src/hotspot/share/memory/universe.cpp | 19 ++++++++++++------- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp index 72a1e78838f..c1e672a0c43 100644 --- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp +++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2021, 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 @@ -426,21 +426,6 @@ void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) { while (ClassLoaderData* X = iter.get_next()) \ if (X->dictionary() != NULL) -// Walk classes in the loaded class dictionaries in various forms. -// Only walks the classes defined in this class loader. -void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*)) { - FOR_ALL_DICTIONARY(cld) { - cld->dictionary()->classes_do(f); - } -} - -// Only walks the classes defined in this class loader. -void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS) { - FOR_ALL_DICTIONARY(cld) { - cld->dictionary()->classes_do(f, CHECK); - } -} - void ClassLoaderDataGraph::verify_dictionary() { FOR_ALL_DICTIONARY(cld) { cld->dictionary()->verify(); diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.hpp b/src/hotspot/share/classfile/classLoaderDataGraph.hpp index ea6bf0129f8..fd5fdca633e 100644 --- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp +++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp @@ -96,13 +96,6 @@ class ClassLoaderDataGraph : public AllStatic { // Called from VMOperation static void walk_metadata_and_clean_metaspaces(); - // dictionary do - // Iterate over all klasses in dictionary, but - // just the classes from defining class loaders. - static void dictionary_classes_do(void f(InstanceKlass*)); - // Added for initialize_itable_for_klass to handle exceptions. - static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS); - // VM_CounterDecay iteration support static InstanceKlass* try_get_next_class(); static void adjust_saved_class(ClassLoaderData* cld); diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index fcc22bdb86f..6c7f5a2fab6 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -523,15 +523,20 @@ static void reinitialize_vtables() { } } - -static void initialize_itable_for_klass(InstanceKlass* k) { - k->itable().initialize_itable(); -} - - static void reinitialize_itables() { + + class ReinitTableClosure : public KlassClosure { + public: + void do_klass(Klass* k) { + if (k->is_instance_klass()) { + InstanceKlass::cast(k)->itable().initialize_itable(); + } + } + }; + MutexLocker mcld(ClassLoaderDataGraph_lock); - ClassLoaderDataGraph::dictionary_classes_do(initialize_itable_for_klass); + ReinitTableClosure cl; + ClassLoaderDataGraph::classes_do(&cl); }