On Sun, 4 Jun 2023 16:12:46 GMT, ExE Boss <d...@openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Improve subsequent VH call performance, thanks exeboss
>
> src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java 
> line 125:
> 
>> 123:                 cache[i] = callTarget;
>> 124:             }
>> 125:         }
> 
> Unlike calling `Unsafe::ensureClassInitialized(…)` (which performs its own 
> synchronisation) or writing `true` to `this.initialized` (which is a benign 
> race), updating the lambda forms this way is probably not quite correct to do 
> under a race and probably needs some synchronisation.

The form update is a benign race. The array update might need some fences, but 
I'm not sure, as the read MH should be complete when the updated value is 
already observed.

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

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

Reply via email to