RFR: 8329750: Change Universe functions to return more specific Klass* types
Dean Long
dlong at openjdk.org
Fri Apr 5 22:13:11 UTC 2024
On Fri, 5 Apr 2024 11:56:11 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> We have various functions in Universe that returns Klass* where they could be returning TypeArrayKlass* and ObjArrayKlass* instead. If we change these functions we could get rid of some casts in the code. Does this seem like a reasonable change?
src/hotspot/share/classfile/systemDictionary.cpp line 370:
> 368: }
> 369: } else {
> 370: k = Universe::typeArrayKlass(t);
Suggestion:
TypeArrayKlass* tak = Universe::typeArrayKlass(t);
k = tak->array_klass(ndims, CHECK_NULL);
src/hotspot/share/classfile/systemDictionary.cpp line 371:
> 369: } else {
> 370: k = Universe::typeArrayKlass(t);
> 371: k = k->array_klass(ndims, CHECK_NULL);
I assume the cast was an attempt to de-virtualize the array_klass() call, so it is better not to use Klass* here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18652#discussion_r1554362911
PR Review Comment: https://git.openjdk.org/jdk/pull/18652#discussion_r1554363063
More information about the graal-dev
mailing list