JDK-6281377 : Provide Unsafe lazy field set methods
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-06-07
  • Updated: 2017-05-19
  • Resolved: 2005-09-17
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 6
6 b53Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Doug Lea writes:

"The request is to add three methods, whose primary use
is to support lazySet, but are also needed to
correctly and efficiently handle barrier-less volatile
writes. For example, setting the parkBlocker in support
of Mandy's stuff. (I can add more explanation and
implementation notes if they would be useful for CCC.)



      /**
       * Version of {@link #putObjectVolatile(Object, long, Object)}
       * that does not guarantee immediate visibility of the store to
       * other threads. This method is generally only useful if the
       * underlying field is a Java volatile (or if an array cell, one
       * that is otherwise only accessed using volatile accesses).
       */
      public native void    putOrderedObject(Object o, long offset,
Object x);

      /** Ordered/Lazy version of {@link #putIntVolatile(Object, long,
int)}  */
      public native void    putOrderedInt(Object o, long offset, int x);

      /** Ordered/Lazy version of {@link #putLongVolatile(Object, long,
long)} */
      public native void    putOrderedLong(Object o, long offset, long x);
"

###@###.### 2005-06-07 07:06:32 GMT

Comments
SUGGESTED FIX --- /tmp/geta14947 2005-09-10 01:14:02.759532000 -0700 +++ Unsafe.java 2005-09-10 01:09:30.954501000 -0700 @@ -778,14 +778,29 @@ /** Volatile version of {@link #getDouble(Object, long)} */ public native double getDoubleVolatile(Object o, long offset); /** Volatile version of {@link #putDouble(Object, long, double)} */ public native void putDoubleVolatile(Object o, long offset, double x); + /** + * Version of {@link #putObjectVolatile(Object, long, Object)} + * that does not guarantee immediate visibility of the store to + * other threads. This method is generally only useful if the + * underlying field is a Java volatile (or if an array cell, one + * that is otherwise only accessed using volatile accesses). + */ + public native void putOrderedObject(Object o, long offset, Object x); + + /** Ordered/Lazy version of {@link #putIntVolatile(Object, long, int)} */ + public native void putOrderedInt(Object o, long offset, int x); + + /** Ordered/Lazy version of {@link #putLongVolatile(Object, long, long)} */ + public native void putOrderedLong(Object o, long offset, long x); + /** * Unblock the given thread blocked on <tt>park</tt>, or, if it is * not blocked, cause the subsequent call to <tt>park</tt> not to * block. Note: this operation is "unsafe" solely because the * caller must somehow ensure that the thread has not been * destroyed. Nothing special is usually required to ensure this * when called from Java (in which there will ordinarily be a live
10-09-2005

SUGGESTED FIX http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2005/20050622152338.jrose.mustang-intrinsics/workspace/webrevs/webrev-2005.06.22/index.html Addendum (see bug 6291823): http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2005/20050628182218.jrose.mustang-intrinsics/workspace/webrevs/webrev-2005.06.28/index.html ###@###.### 2005-06-30 21:30:01 GMT
30-06-2005

EVALUATION Hotspot implementation being provided by Doug Lea. ###@###.### 2005-06-07 07:06:32 GMT
07-06-2005