RFR: 8275063: Implementation of Foreign Function & Memory API (Second incubator) [v5]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Oct 15 16:56:08 UTC 2021


On Fri, 15 Oct 2021 16:54:58 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR contains the API and implementation changes for JEP-419 [1]. A more detailed description of such changes, to avoid repetitions during the review process, is included as a separate comment.
>> 
>> [1] - https://openjdk.java.net/jeps/419
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   * Fix javadoc issue in VaList
>   * Fix bug in concurrent logic for shared scope acquire

src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/SharedScope.java line 138:

> 136:                 ResourceCleanup prev = (ResourceCleanup) FST.getAcquire(this);
> 137:                 cleanup.next = prev;
> 138:                 ResourceCleanup newSegment = (ResourceCleanup) FST.compareAndExchangeRelease(this, prev, cleanup);

In this place we can actually overwrite CLOSED_LIST (if getAcquired has seen such value). While this particular add will fail later on (since we check witness), another concurrent add might then pass, since it sees a value other than CLOSED_LIST (which is supposed to be a terminal state).

Also, after consulting with @DougLea  and @shipilev  - it seems like using volatile semantics is the way to go here.

This should fix a spurious (and very rare) failure on TestResourceScope on arm64.

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

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


More information about the nio-dev mailing list