On Tue, 17 May 2022 05:51:58 GMT, Rémi Forax <fo...@openjdk.org> wrote:

>> Jorn Vernee has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   BootstrapMethodError -> ExceptionInInitializerError
>
> src/java.base/share/classes/jdk/internal/foreign/abi/SoftReferenceCache.java 
> line 42:
> 
>> 40: 
>> 41:     private class Node {
>> 42:         private SoftReference<V> ref;
> 
> this code looks like a double check locking so ref should be volatile

Thanks. I thought the `moniterenter` & `monitorexit` were enough here for 
visibility. I've read up on this and it looks like `volatile` is needed to 
correctly order the constructor and apply call (and contents) before the write 
to the `ref` field.

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

PR: https://git.openjdk.java.net/jdk/pull/8685

Reply via email to