RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v41]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Apr 4 10:24:11 UTC 2025
On Fri, 4 Apr 2025 09:14:22 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:
>
> Address comments on docs
src/java.base/share/classes/java/lang/StableValue.java line 407:
> 405: * The _content_ of a set stable value is treated as a constant by the JVM, provided that
> 406: * the reference to the stable value is also constant (e.g. in cases where the
> 407: * stable value itself is stored in a `static final` field).
watch out for the markdown quotes :-)
src/java.base/share/classes/java/lang/StableValue.java line 411:
> 409: * This means that, at least in some cases, access to the content of a stable value
> 410: * enjoys the same constant-folding optimizations that are available when accessing
> 411: * `static final` fields.
We probably need to extra para that says something about stable suppliers/functions etc. E.g. since these are cleanly built on top of SV, if these are constants (again, stored in `static final` field) their access can be constant-folded. E.g. make it clear that this property is compositional. It doesn't just hold for a single constant SV, but also for another constant objects that wraps a SV.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2028542265
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2028544663
More information about the core-libs-dev
mailing list