JDK-8156068 : Unsafe.{get|set}Opaque should be single copy atomic
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-04
  • Updated: 2016-05-26
  • Resolved: 2016-05-06
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 9
9 b120Fixed
Description
Current C2 intrinsic code makes Opaque a "relaxed" plain load/store with regards to single copy atomicity.

  bool requires_atomic_access = false;
  switch (kind) {
      case Relaxed:
      case Opaque:
          requires_atomic_access = AlwaysAtomicAccesses;
          break;

This contradicts the intent of making Opaque similar to std::atomic...(..., memory_order_relaxed), which is single copy atomic.