RFR: 8264774: Implementation of Foreign Function and Memory API (Incubator) [v2]
mcimadamore at openjdk.java.net
Wed Apr 28 21:49:50 UTC 2021
On Wed, 28 Apr 2021 18:44:18 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> I think the method is called during module bootstrap - I don't think there is a race in practice. This method is also called in other parts of ModuleBootstrap. The code you allude to is called during initialization of the IllegalNativeAccessChecker singleton, which should happen only once, and only from one thread.
> I'll take your word for it - the use of a volatile variable to store the singleton instance made this suspicious.
good point - I think that came in when I adapted the code from IllegalAccessLogger - which can indeed be accessed from multiple threads. In this case the initialization is effectively part of bootstrap, and volatile is not required.
More information about the core-libs-dev