JDK-8351211 : [lworld] Atomic layout access support in Unsafe
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-03-04
  • Updated: 2025-03-10
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.
Other
repo-valhallaUnresolved
Related Reports
Relates :  
Description
To implement JDK-8348608, core libraries need runtime API support to access atomic-compatible layout flat values.

Critical APIs requested for flat values from runtime, for modes:
get/setVolatile, compareAndSet, compareAndExchange.

Please name their native methods with a 0 suffix like getFlatValueVolatile0 to allow core library to add check to ensure the incoming layout is valid.

Other APIs can be implemented by core library's unsafe, such as:
getAcquire, setRelease, get/setOpaque, getAndSet...

Also, core library will need to check if a layout value is valid. That is probably best done in Java to avoid native overheads. Maybe we can add a native method that return a bit mask, marking layouts that are flat atomics with 1, and unsafe call this in an initializer. Otherwise, future layout changes in runtime may forget to update core libs code and cause crashes.