JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

Johannes Kuhn info at j-kuhn.de
Mon Feb 8 13:29:55 UTC 2021


I now implemented a prototype for JDK-6824466: [1]

The goal I set here was to remove the old AccessorGenerator.

The good news:

- It works - all tier1 tests pass, except one that requires the old 
implementation.
- A lot of code has been removed. And even more could be removed.

The bad news:

- I hit a performance regression [2].

The JMH tests were written by Peter Levart [3].
As much as I don't like the old AccessorGenerator, I have to say that it 
is very optimized.

If you have any ideas on how the performance could be improved, or how I 
could find that out where the performance drops, let me know.

- Johannes

PS.: I played around with adding some @Stable and @ForceInline 
annotations, and got a big performance improvement for the const cases 
(~9 ns/op). But that came with other performance regressions for the 
non-const cases.


[1]: https://github.com/openjdk/jdk/pull/2457
[2]: 
https://gist.github.com/DasBrain/09b37510955b14f0ad82313df8d8de37#gistcomment-3623292
[3]: 
http://cr.openjdk.java.net/~plevart/jdk-dev/6824466_MHReflectionAccessors/


More information about the core-libs-dev mailing list