You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2009/07/25 15:37:11 UTC

svn commit: r797766 - in /harmony/enhanced: classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java

Author: hindessm
Date: Sat Jul 25 13:37:11 2009
New Revision: 797766

URL: http://svn.apache.org/viewvc?rev=797766&view=rev
Log:
Implement some new methods (for concurrent) in terms of existing methods
which are more strict than necessary but should do for now.  Ideally we
should implement them properly in VM natives.

Modified:
    harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java

Modified: harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java?rev=797766&r1=797765&r2=797766&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java (original)
+++ harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java Sat Jul 25 13:37:11 2009
@@ -177,6 +177,22 @@
     }
 
     /**
+     * Writes an int value to an Object's field using ordered
+     * setting. Ordered setting of a field is equivalent to the
+     * volatile setting of that field except that it does not ensure
+     * that the change is immediately available to other threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the int field in the object.
+     * @param newValue The value to write.
+     */
+    public void putOrderedInt(Object object, long fieldOffset,
+                              int newValue) {
+        // should probably implement less strict implementation
+        putIntVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
      * <p>
      * Writes an int value to an Object's field as though it were declared
      * <code>volatile</code>.
@@ -205,6 +221,22 @@
     }
 
     /**
+     * Writes a long value to an Object's field using ordered
+     * setting. Ordered setting of a field is equivalent to the
+     * volatile setting of that field except that it does not ensure
+     * that the change is immediately available to other threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putOrderedLong(Object object, long fieldOffset,
+                               long newValue) {
+        // should probably implement less strict implementation
+        putLongVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
      * <p>
      * Writes a long value to an Object's field as though it were declared
      * <code>volatile</code>.
@@ -234,6 +266,38 @@
 
     /**
      * <p>
+     * Writes an Object reference value to an Object's field.
+     * </p>
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putObject(Object object, long fieldOffset,
+                          Object newValue) {
+        // should probably implement less strict implementation
+        putOrderedObject(object, fieldOffset, newValue);
+    }
+
+    /**
+     * Writes an Object reference value to an Object's field using
+     * ordered setting. Ordered setting of a field is equivalent to
+     * the volatile setting of that field except that it does not
+     * ensure that the change is immediately available to other
+     * threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putOrderedObject(Object object, long fieldOffset,
+                                 Object newValue) {
+        // should probably implement less strict implementation
+        putObjectVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
+     * <p>
      * Writes an Object reference value to an Object's field as though it were
      * declared <code>volatile</code>.
      * </p>

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java?rev=797766&r1=797765&r2=797766&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java Sat Jul 25 13:37:11 2009
@@ -154,6 +154,22 @@
     }
 
     /**
+     * Writes an int value to an Object's field using ordered
+     * setting. Ordered setting of a field is equivalent to the
+     * volatile setting of that field except that it does not ensure
+     * that the change is immediately available to other threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the int field in the object.
+     * @param newValue The value to write.
+     */
+    public void putOrderedInt(Object object, long fieldOffset,
+                              int newValue) {
+        // should probably implement less strict implementation
+        putIntVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
      * <p>
      * Writes an int value to an Object's field as though it were declared
      * <code>volatile</code>.
@@ -182,6 +198,22 @@
     }
 
     /**
+     * Writes a long value to an Object's field using ordered
+     * setting. Ordered setting of a field is equivalent to the
+     * volatile setting of that field except that it does not ensure
+     * that the change is immediately available to other threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putOrderedLong(Object object, long fieldOffset,
+                               long newValue) {
+        // should probably implement less strict implementation
+        putLongVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
      * <p>
      * Writes a long value to an Object's field as though it were declared
      * <code>volatile</code>.
@@ -211,6 +243,38 @@
 
     /**
      * <p>
+     * Writes an Object reference value to an Object's field.
+     * </p>
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putObject(Object object, long fieldOffset,
+                          Object newValue) {
+        // should probably implement less strict implementation
+        putOrderedObject(object, fieldOffset, newValue);
+    }
+
+    /**
+     * Writes an Object reference value to an Object's field using
+     * ordered setting. Ordered setting of a field is equivalent to
+     * the volatile setting of that field except that it does not
+     * ensure that the change is immediately available to other
+     * threads.
+     * 
+     * @param object The instance containing the field to write to.
+     * @param fieldOffset The offset of the field to write to.
+     * @param newValue The value to write.
+     */
+    public void putOrderedObject(Object object, long fieldOffset,
+                                 Object newValue) {
+        // should probably implement less strict implementation
+        putObjectVolatile(object, fieldOffset, newValue);
+    }
+
+    /**
+     * <p>
      * Writes an Object reference value to an Object's field as though it were
      * declared <code>volatile</code>.
      * </p>