RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

Quan Anh Mai qamai at openjdk.org
Wed Apr 2 19:25:14 UTC 2025


On Wed, 2 Apr 2025 13:22:44 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Implement JEP 502.
>> 
>> The PR passes tier1-tier3 tests.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add info that Map#values and Map#entrySet are stable

src/java.base/share/classes/java/lang/StableValue.java line 402:

> 400:  * race. Since stable functions and stable collections are built on top of
> 401:  * {@linkplain StableValue#orElseSet(Supplier) orElseSet()} they too are
> 402:  * thread safe and guarantee at-most-once-per-input invocation.

Do we guarantee that there is a total order with respect to the suppliers that fail to return. You can take a look at the specification of [`std::call_once`](https://en.cppreference.com/w/cpp/thread/call_once)

> All active calls on the same flag form a single total order consisting of zero or more exceptional calls, followed by one returning call. The end of each active call synchronizes-with the next active call in that order.
> The return from the returning call synchronizes-with the returns from all passive calls on the same flag: this means that all concurrent calls to std::call_once are guaranteed to observe any side-effects made by the active call, with no additional synchronization.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2025454935


More information about the core-libs-dev mailing list