On Fri, 18 Apr 2025 12:33:49 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Address comments on original vs underlying > > src/java.base/share/classes/java/lang/StableValue.java line 363: > >> 361: * The content of a stable value is guaranteed to be set at most once. >> If competing >> 362: * threads are racing to set a stable value, only one update succeeds, >> while other updates >> 363: * are blocked until the stable value becomes set. > > I think it would be good to say here that the blocked updates will be > discarded, or something to that effect. The current sentence can be > interpreted as the blocked updates still taking place after the SV becomes > set. Indeed, something like "other updates will block and then observe the stable value is set" > src/java.base/share/classes/java/lang/StableValue.java line 396: > >> 394: * stable value itself is stored in a {@code static final} field). >> Stable functions and >> 395: * collections are built on top of StableValue. As such, they are also >> treated as >> 396: * constants by the JVM. > > This doesn't seem quite correct. stable collections aren't necessarily > treated as constant, you need a constant reference, e.g. stored in a static > final field. The contents can be treated as constant though. > > Suggestion: > > * collections are built on top of StableValue. As such, their contents is > also treated as > * constant by the JVM. "their contents are" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2050775415 PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2050775808