RFR: 8291065: Creating a VarHandle for a static field triggers class initialization [v14]

Paul Sandoz psandoz at openjdk.org
Wed Jun 28 19:22:10 UTC 2023


On Tue, 27 Jun 2023 23:33:25 GMT, Chen Liang <liach at openjdk.org> wrote:

>> test/micro/org/openjdk/bench/java/lang/invoke/LazyStaticColdStart.java line 92:
>> 
>>> 90:             });
>>> 91: 
>>> 92:             static {
>> 
>> Is this static block required?
>
> I use this block to remove the overhead around MethodHandle and VarHandle infrastructure initialization (such as LF spinning) that is not related to any particular class; so that I measure only the impact of encountering a new class.

Ah, implied by "... and initializes the lazy/non-lazy handles to prevent further creation costs" Could you also add a small comment above this block?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1245655494


More information about the core-libs-dev mailing list