RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v5]
Chen Liang
liach at openjdk.org
Wed Jun 7 22:44:57 UTC 2023
On Wed, 7 Jun 2023 20:26:47 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
> Change only the static field var handle implementations to call `target()`, since it is unnecessary on the others.
Unfortunately, I don't think there is a convenient way for VH implementations to easily unwrap the correct VH; a `target()` call is more convenient than an extra instanceof check and cast and get.
> I am wondering if the simplest approach in `initialize` is to set the `methodHandleTable` to null?
I update the entries in the table because they are already created and potentially live on the heap or stack. Those entries should benefit from the post-initialization performance benefits as well.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13821#issuecomment-1581603143
More information about the core-libs-dev
mailing list