On Mon, 27 Sep 2021 17:31:50 GMT, Mandy Chung <mch...@openjdk.org> wrote:

> Looks good to me. Very nice performance improvement.
> 
> One minor comment: I think the change in `UnsafeFieldAccessorImpl.java` and 
> `UnsafeStaticFieldAccessorImpl.java` isn't necessary since they're final 
> fields. It can be reverted.

There are two changes in `UnsafeFieldAccessorImpl.java` and 
`UnsafeStaticFieldAccessorImpl.java`. One is making `fieldOffset` and `base` 
(for static fields) @Stable and the other is moving `field` one level up to 
`FieldAccessorImpl` and making it @Stable. This later change is not necessary 
for this patch, but I noticed that you did that in JEP 416 so that `field` is 
common to all subclasses of `FieldAccessorImpl` including those that you are 
adding in JEP 416. I can undo this later change. But making fields @Stable does 
improve performance since `jdk.internal.reflect` and `java.lang.reflect` are 
not final-field-trusted packages as you noted above. If JEP 416 makes them 
trusted, it can also remove the @Stable annotations. But for backporting, they 
better stay there. WDYT?

-------------

PR: https://git.openjdk.java.net/jdk/pull/5694

Reply via email to