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

Incorrect doc for storeFence() in sun.misc.Unsafe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 8
    • core-libs

      A DESCRIPTION OF THE PROBLEM :
      Javadoc for Unsafe.storeFence() claims that it inserts StoreLoad memory barrier, but actually it transforms to membar_release() which has no such guarantee. StoreLoad is inserted by fullFence() only.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      /**
       * Ensures lack of reordering of loads or stores before the fence
       * with stores after the fence.
       * @since 1.8
       */
      public native void storeFence();
      ACTUAL -
      /**
       * Ensures lack of reordering of stores before the fence
       * with loads or stores after the fence.
       * @since 1.8
       */
      public native void storeFence();

      URL OF FAULTY DOCUMENTATION :
      http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/sun/misc/Unsafe.java

            martin Martin Buchholz
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: