8266904: Use function pointer typedefs in OopOopIterateDispatch

Reviewed-by: tschatzl, iklam
This commit is contained in:
Stefan Karlsson 2021-05-14 07:55:23 +00:00
parent 301095c8be
commit 88907bb81a

View file

@ -206,6 +206,8 @@ void Devirtualizer::do_cld(OopClosureType* closure, ClassLoaderData* cld) {
template <typename OopClosureType> template <typename OopClosureType>
class OopOopIterateDispatch : public AllStatic { class OopOopIterateDispatch : public AllStatic {
private: private:
typedef void (*FunctionType)(OopClosureType*, oop, Klass*);
class Table { class Table {
private: private:
template <typename KlassType, typename T> template <typename KlassType, typename T>
@ -242,7 +244,7 @@ private:
} }
public: public:
void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*); FunctionType _function[KLASS_ID_COUNT];
Table(){ Table(){
set_init_function<InstanceKlass>(); set_init_function<InstanceKlass>();
@ -257,7 +259,7 @@ private:
static Table _table; static Table _table;
public: public:
static void (*function(Klass* klass))(OopClosureType*, oop, Klass*) { static FunctionType function(Klass* klass) {
return _table._function[klass->id()]; return _table._function[klass->id()];
} }
}; };
@ -269,6 +271,8 @@ typename OopOopIterateDispatch<OopClosureType>::Table OopOopIterateDispatch<OopC
template <typename OopClosureType> template <typename OopClosureType>
class OopOopIterateBoundedDispatch { class OopOopIterateBoundedDispatch {
private: private:
typedef void (*FunctionType)(OopClosureType*, oop, Klass*, MemRegion);
class Table { class Table {
private: private:
template <typename KlassType, typename T> template <typename KlassType, typename T>
@ -302,7 +306,7 @@ private:
} }
public: public:
void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*, MemRegion); FunctionType _function[KLASS_ID_COUNT];
Table(){ Table(){
set_init_function<InstanceKlass>(); set_init_function<InstanceKlass>();
@ -317,7 +321,7 @@ private:
static Table _table; static Table _table;
public: public:
static void (*function(Klass* klass))(OopClosureType*, oop, Klass*, MemRegion) { static FunctionType function(Klass* klass) {
return _table._function[klass->id()]; return _table._function[klass->id()];
} }
}; };
@ -329,6 +333,8 @@ typename OopOopIterateBoundedDispatch<OopClosureType>::Table OopOopIterateBounde
template <typename OopClosureType> template <typename OopClosureType>
class OopOopIterateBackwardsDispatch { class OopOopIterateBackwardsDispatch {
private: private:
typedef void (*FunctionType)(OopClosureType*, oop, Klass*);
class Table { class Table {
private: private:
template <typename KlassType, typename T> template <typename KlassType, typename T>
@ -362,7 +368,7 @@ private:
} }
public: public:
void (*_function[KLASS_ID_COUNT])(OopClosureType*, oop, Klass*); FunctionType _function[KLASS_ID_COUNT];
Table(){ Table(){
set_init_function<InstanceKlass>(); set_init_function<InstanceKlass>();
@ -377,7 +383,7 @@ private:
static Table _table; static Table _table;
public: public:
static void (*function(Klass* klass))(OopClosureType*, oop, Klass*) { static FunctionType function(Klass* klass) {
return _table._function[klass->id()]; return _table._function[klass->id()];
} }
}; };