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

Chen Liang liach at openjdk.org
Tue Jun 27 23:39:21 UTC 2023


On Tue, 27 Jun 2023 21:14:23 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rollback VHG changes
>
> test/jdk/java/lang/invoke/VarHandles/LazyInitializingTest.java line 85:
> 
>> 83: 
>> 84:     @Test
>> 85:     public void testInitializationOnVarHandleUse() {
> 
> I think we will need to expand this to also test operating on a MH to a VH, an indirect VH, and on a MH to indirect VH. We could do this separately.

The MH on VH case is worth considering; the indirect VH cases are already covered by `-Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true`.

> 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.

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

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


More information about the core-libs-dev mailing list