JDK-8314480 : Memory ordering spec updates in java.lang.ref
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-08-16
  • Updated: 2024-06-08
  • Resolved: 2024-05-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b26Fixed
Related Reports
CSR :  
Relates :  
Description
Classes in the java.lang.ref package would benefit from an update to bring the spec in line with how the VM already behaves. The changes would focus on happens-before edges at some key points during reference processing.

A couple key things we want to be able to say are:
* Reference.reachabilityFence(x) happens-before reference processing occurs for 'x'.
* Cleaner.register() happens-before the Cleaner thread runs the registered cleaning action. 

This will bring Cleaner in line (or close) with the memory visibility guarantees made for finalizers in JLS 17.4.5[1]:
"There is a happens-before edge from the end of a constructor of an object to the start of a finalizer (ยง12.6) for that object."

1. https://docs.oracle.com/javase/specs/jls/se18/html/jls-17.html#jls-17.4.5

Comments
I just read through the updated Reference.java, and it seems OK to me.
08-06-2024

Changeset: 2cae9a03 Author: Brent Christian <bchristi@openjdk.org> Date: 2024-05-31 21:29:30 +0000 URL: https://git.openjdk.org/jdk/commit/2cae9a0397f4e46c6faec0a998ecad1c7015564d
31-05-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16644 Date: 2023-11-13 22:31:16 +0000
13-11-2023