[code-reflection] RFR: Lazily invoke lambda op building method [v2]

Mourad Abbay mabbay at openjdk.org
Fri Dec 19 22:21:21 UTC 2025


On Fri, 19 Dec 2025 20:37:40 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Mourad Abbay has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Use local variables to reduce number of time we load fields
>>  - Use CodeBuilder.IfThen
>>  - document the equivalent java code for helpers methods
>
> src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 553:
> 
>> 551: 
>> 552:         clb.withMethod("getModel", MethodTypeDesc.of(reflectableLambdaInfo.funcOpClass()),
>> 553:                 ACC_PRIVATE + ACC_STATIC + ACC_SYNCHRONIZED,
> 
> This method does not need to be synchronized since it is only called by `getQuoted` which is synchronized.

The method is static. So two instance of the lambda class can call it in parallel making the value of the field model undefined and we can no longer guarantee that model is shared.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636457630


More information about the babylon-dev mailing list