United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6281377 Provide Unsafe lazy field set methods
JDK-6281377 : Provide Unsafe lazy field set methods

Details
Type:
Enhancement
Submit Date:
2005-06-07
Status:
Resolved
Updated Date:
2012-02-01
Project Name:
JDK
Resolved Date:
2005-09-17
Component:
core-libs
OS:
generic
Sub-Component:
java.util.concurrent
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Duplicate:
Relates:
Relates:

Sub Tasks

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
EVALUATION

Hotspot implementation being provided by Doug Lea.

###@###.### 2005-06-07 07:06:32 GMT
                                     
2005-06-07
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
                                     
2005-06-30
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
                                     
2005-09-10



Hardware and Software, Engineered to Work Together