On Wed, 5 Feb 2025 19:42:02 GMT, Coleen Phillimore <[email protected]> wrote:
>> test/micro/org/openjdk/bench/java/lang/reflect/Clazz.java line 73:
>>
>>> 71: public int getAppArrayModifiers() {
>>> 72: return clazzArray.getClass().getModifiers();
>>> 73: }
>>
>> I'm guessing this is the benchmark that shows an extra load. How about
>> adding a benchmark that makes the Clazz[] final or @Stable, and see if that
>> makes the extra load go away?
>
> Name Cnt Base Error Test Error Unit Change
> getAppArrayModifiers 30 0.923 ± 0.004 1.260 ± 0.001 ns/op 0.73x (p =
> 0.000*)
> getAppArrayModifiersFinal 30 0.922 ± 0.000 1.260 ± 0.001 ns/op 0.73x (p =
> 0.000*)
>
> No it doesn't really help. There's still an extra load.
OK, if the extra load turns out to be a problem in the future, we could look
into why the compilers are generating the load when the Class is
known/constant. If the old intrinsic was able to pull the constant out of the
Klass, then surely we can do the same and pull the value from the Class field.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22652#discussion_r1943616021