From 88907bb81a5a67a51f32c36f6cd821c2488117eb Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Fri, 14 May 2021 07:55:23 +0000 Subject: [PATCH] 8266904: Use function pointer typedefs in OopOopIterateDispatch Reviewed-by: tschatzl, iklam --- src/hotspot/share/memory/iterator.inline.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/memory/iterator.inline.hpp b/src/hotspot/share/memory/iterator.inline.hpp index 36ee100397d..ba896f4e1d4 100644 --- a/src/hotspot/share/memory/iterator.inline.hpp +++ b/src/hotspot/share/memory/iterator.inline.hpp @@ -206,6 +206,8 @@ void Devirtualizer::do_cld(OopClosureType* closure, ClassLoaderData* cld) { template class OopOopIterateDispatch : public AllStatic { private: + typedef void (*FunctionType)(OopClosureType*, oop, Klass*); + class Table { private: template @@ -242,7 +244,7 @@ private: } public: - void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*); + FunctionType _function[KLASS_ID_COUNT]; Table(){ set_init_function(); @@ -257,7 +259,7 @@ private: static Table _table; public: - static void (*function(Klass* klass))(OopClosureType*, oop, Klass*) { + static FunctionType function(Klass* klass) { return _table._function[klass->id()]; } }; @@ -269,6 +271,8 @@ typename OopOopIterateDispatch::Table OopOopIterateDispatch class OopOopIterateBoundedDispatch { private: + typedef void (*FunctionType)(OopClosureType*, oop, Klass*, MemRegion); + class Table { private: template @@ -302,7 +306,7 @@ private: } public: - void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*, MemRegion); + FunctionType _function[KLASS_ID_COUNT]; Table(){ set_init_function(); @@ -317,7 +321,7 @@ private: static Table _table; public: - static void (*function(Klass* klass))(OopClosureType*, oop, Klass*, MemRegion) { + static FunctionType function(Klass* klass) { return _table._function[klass->id()]; } }; @@ -329,6 +333,8 @@ typename OopOopIterateBoundedDispatch::Table OopOopIterateBounde template class OopOopIterateBackwardsDispatch { private: + typedef void (*FunctionType)(OopClosureType*, oop, Klass*); + class Table { private: template @@ -362,7 +368,7 @@ private: } public: - void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*); + FunctionType _function[KLASS_ID_COUNT]; Table(){ set_init_function(); @@ -377,7 +383,7 @@ private: static Table _table; public: - static void (*function(Klass* klass))(OopClosureType*, oop, Klass*) { + static FunctionType function(Klass* klass) { return _table._function[klass->id()]; } };