[foreign-memaccess+abi] RFR: 8293367: Enable native access for modules not in the boot layer [v2]
Jorn Vernee
jvernee at openjdk.org
Wed Sep 21 13:18:59 UTC 2022
On Wed, 21 Sep 2022 13:08:49 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> review comments.
>
> src/java.base/share/classes/java/lang/Module.java line 275:
>
>> 273: public boolean isNativeAccessEnabled() {
>> 274: Module target = enableNativeAccessHolder();
>> 275: synchronized(target) {
>
> I'm not sure how much of a problem this is, but I guess since the module object is publicly accessible, it's theoretically possible that some user code is also locking on it.
>
> For the record; alternative could be to add a private field to module with a dedicated lock Object for enabling native access. Though, I don't think that's needed at the moment.
Or, maybe it's possible to do this in a lock-free manner altogether? i.e. `implAddEnableNativeAccess` and would use a volatile write, and `isNativeAccessEnabled` and `ensureNativeAccess` would use volatile reads instead of synchronized blocks. (assuming we can use `Unsafe` at this point).
-------------
PR: https://git.openjdk.org/panama-foreign/pull/729
More information about the panama-dev
mailing list