[foreign-memaccess+abi] RFR: 8293367: Enable native access for modules not in the boot layer [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Sep 21 11:42:15 UTC 2022
On Wed, 21 Sep 2022 11:05:18 GMT, Alan Bateman <alanb 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 277:
>
>> 275: synchronized(target) {
>> 276: return target.enableNativeAccess;
>> 277: }
>
> enableNativeAccess is `@Stable` and I'm trying to understand the access. ensureNativeAccess will only synchronize when false, isNativeAccessEnabled synchronizes always. Is that intentional?
That is intentional. `ensureNativeAccess` can be called in hot paths, so it's crucial we only synchronized when needed (so we do an optimistic plain read and lock if we see `false`). The new API predicate on `Module` is a public API, so we do not have the same performance constraints there, and we can make the implementation more intuitive.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/729
More information about the panama-dev
mailing list