RFR: 8314480: Memory ordering spec updates in java.lang.ref [v13]

David Holmes dholmes at openjdk.org
Tue Mar 19 02:56:24 UTC 2024


On Tue, 19 Mar 2024 00:40:02 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> Brent Christian has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   further tweaks to reachability
>
> src/java.base/share/classes/java/lang/ref/package-info.java line 137:
> 
>> 135:  *
>> 136:  * A <em>reachable</em> object is any object that can be accessed in any potential
>> 137:  * continuing computation from any live thread (as stated in {@jls 12.6.1}).
> 
> This seems like somewhat loose and sloppy wording to me. "Any potential continuing computation"? "Any live thread"? Could you share a pointer to JLS 12.6.1 being referenced here?

https://docs.oracle.com/javase/specs/jls/se21/html/jls-12.html#jls-12.6.1

> A reachable object is any object that can be accessed in any potential continuing computation from any live thread. 

It may be "loose" because the devil is in the details when it comes to reachability, but I disagree that it is "sloppy". This expresses reachability in simple terms, as a "first-order" or "Newtonian" model. There are of course "Quantum" effects that need to be dealt with in practice. The JLS alludes to this with:
> Optimizing transformations of a program can be designed that reduce the number of objects that are reachable to be less than those which would naively be considered reachable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16644#discussion_r1529617062


More information about the core-libs-dev mailing list