Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8252529

Unsafe Documentation around Barrier Methods Inaccurate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 9, 10, 11, 13, 14
    • Fix Version/s: 16
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b14
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description

      When reviewing some of the documentation in jdk.internal.misc.Unsafe, it appears that there is some dated information regarding the availability of "pure barrier" methods (i.e. pure StoreStoreFence sans a LoadStore barrier). When the storeFence() and loadFence() methods were implemented the pure variations (loadLoadFence(), storeStoreFence()) were not implemented and the documentation indicated as much. This is no longer the case.

      I've included a patch with this email that updates the docs to reflect the new state of affairs here as well as indicate some implementation details as to how the pure variants utilize the impure original methods.

      The parts of the documentation in the sentence on
      - https://github.com/openjdk/jdk/blob/d7ca08a5cc64c8d3941493d98423a49b5bc1b922/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L3415
      - https://github.com/openjdk/jdk/blob/d7ca08a5cc64c8d3941493d98423a49b5bc1b922/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L3400

      No longer as such methods do exist in Unsafe now.

      Additionally documentation clarifying Java version since info and implementation details should be added to the "pure" barrier methods.

      - https://github.com/openjdk/jdk/blob/d7ca08a5cc64c8d3941493d98423a49b5bc1b922/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L3444
      - https://github.com/openjdk/jdk/blob/d7ca08a5cc64c8d3941493d98423a49b5bc1b922/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L3436

        Attachments

          Activity

            People

            Assignee:
            igraves Ian Graves
            Reporter:
            igraves Ian Graves
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: