RFR(s): 8191859: SoftReference clock/timestamp should be declared volatile
Thomas Schatzl
thomas.schatzl at oracle.com
Fri Nov 24 17:11:00 UTC 2017
Hi,
On Fri, 2017-11-24 at 14:13 +0100, Per Liden wrote:
> The clock and timestamp fields in SoftReference should be declared
> volatile. These fields are read or updated by the VM, (possibly)
> concurrently with the execution of Java threads.
>
> To be more specific, the timestamp field is read by the GC during
> reference discovery, e.g. during G1/CMS concurrent mark. The clock
> is updated by the GC, typically after reference processing has
> completed.
>
> Webrev: http://cr.openjdk.java.net/~pliden/8191859/webrev.0/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8191859
>
looks good to me.
Thomas
More information about the core-libs-dev
mailing list