harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r431519 - in /incubator/harmony/enhanced/drlvm/trunk/vm: tests/ vmcore/include/ vmcore/src/kernel_classes/ vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/ vmcore/src/kernel_classes/javasrc/sun/ vmcore/src/kernel_classe...
Date Tue, 15 Aug 2006 03:46:27 GMT
Author: ndbeyer
Date: Mon Aug 14 20:46:26 2006
New Revision: 431519

URL: http://svn.apache.org/viewvc?rev=431519&view=rev
Log:
Apply patch for HARMONY-1144: [j.u.c integration with DRLVM - step#1]: implement getFieldOffset and modify compareAndSet<*> methods

Added:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java   (with props)
Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/tests/   (props changed)
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/atomics.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/   (props changed)
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/atomics.cpp

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 14 20:46:26 2006
@@ -0,0 +1 @@
+bin

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/atomics.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/atomics.h?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/atomics.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/atomics.h Mon Aug 14 20:46:26 2006
@@ -1,89 +1,93 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/** 
- * @author Andrey Chernyshev
- * @version $Revision: 1.1.2.1.4.4 $
- */  
-
-#ifndef _ATOMICS_H_
-#define _ATOMICS_H_
-
-#include "jni.h"
-#include "Class.h"
-#include "vm_synch.h"
-
-JNIEXPORT jboolean compareAndSetObjectField
-  (JNIEnv * env, jobject self, jobject obj, jobject fieldID, jobject expected, jobject value);
-      
-JNIEXPORT jboolean compareAndSetBooleanField
-  (JNIEnv * env, jobject self, jobject obj, jobject fieldID, jboolean expected, jboolean value);
-                  
-JNIEXPORT jboolean compareAndSetIntField
-  (JNIEnv * env, jobject self, jobject obj, jobject fieldID, jint expected, jint value);
-                  
-JNIEXPORT jboolean compareAndSetLongField
-  (JNIEnv * env, jobject self, jobject obj, jobject fieldID, jlong expected, jlong value);
-               
-JNIEXPORT jboolean compareAndSetObjectArray
-(JNIEnv * env, jobject self, jobjectArray array, jint index, jobject expected, jobject value);
-
-JNIEXPORT jboolean compareAndSetBooleanArray
-(JNIEnv * env, jobject self, jbooleanArray array, jint index, jboolean expected, jboolean value);
-
-JNIEXPORT jboolean compareAndSetIntArray
-(JNIEnv * env, jobject self, jintArray array, jint index, jint expected, jint value);
-
-JNIEXPORT jboolean compareAndSetLongArray
-(JNIEnv * env, jobject self, jlongArray array, jint index, jlong expected, jlong value);
-
-//void MemoryReadWriteBarrier();
-
-#if defined (PLATFORM_POSIX) 
-    #if defined (_IPF_)
-        inline void MemoryReadWriteBarrier() {
-            asm volatile ("mf" ::: "memory");
-        }
-        inline void MemoryWriteBarrier() {
-            asm volatile ("mf" ::: "memory");
-        }
-    #else 
-        inline void MemoryReadWriteBarrier() {
-            __asm__("mfence");
-        } 
-        inline void MemoryWriteBarrier() {
-            __asm__("sfence");
-        } 
-    #endif
-#else
-    #if defined (_IPF_)
-        inline void MemoryReadWriteBarrier() {
-            __asm mf;
-        }
-        inline void MemoryWriteBarrier() {
-            __asm mf;
-        }
-    #else
-        inline void MemoryReadWriteBarrier() {
-            __asm mfence;
-        }
-        inline void MemoryWriteBarrier() {
-            __asm sfence;
-        }
-    #endif
-#endif
-
-#endif // _ATOMICS_H_
-
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Andrey Chernyshev
+ * @version $Revision: 1.1.2.1.4.4 $
+ */  
+
+#ifndef _ATOMICS_H_
+#define _ATOMICS_H_
+
+#include "jni.h"
+#include "Class.h"
+#include "vm_synch.h"
+
+
+JNIEXPORT jlong getFieldOffset
+  (JNIEnv * env, jobject field);
+
+JNIEXPORT jboolean compareAndSetObjectField
+  (JNIEnv * env, jobject self, jobject obj, jlong offset, jobject expected, jobject value);
+      
+JNIEXPORT jboolean compareAndSetBooleanField
+  (JNIEnv * env, jobject self, jobject obj, jlong offset, jboolean expected, jboolean value);
+                  
+JNIEXPORT jboolean compareAndSetIntField
+  (JNIEnv * env, jobject self, jobject obj, jlong offset, jint expected, jint value);
+                  
+JNIEXPORT jboolean compareAndSetLongField
+  (JNIEnv * env, jobject self, jobject obj, jlong offset, jlong expected, jlong value);
+               
+JNIEXPORT jboolean compareAndSetObjectArray
+(JNIEnv * env, jobject self, jobjectArray array, jint index, jobject expected, jobject value);
+
+JNIEXPORT jboolean compareAndSetBooleanArray
+(JNIEnv * env, jobject self, jbooleanArray array, jint index, jboolean expected, jboolean value);
+
+JNIEXPORT jboolean compareAndSetIntArray
+(JNIEnv * env, jobject self, jintArray array, jint index, jint expected, jint value);
+
+JNIEXPORT jboolean compareAndSetLongArray
+(JNIEnv * env, jobject self, jlongArray array, jint index, jlong expected, jlong value);
+
+//void MemoryReadWriteBarrier();
+
+#if defined (PLATFORM_POSIX) 
+    #if defined (_IPF_)
+        inline void MemoryReadWriteBarrier() {
+            asm volatile ("mf" ::: "memory");
+        }
+        inline void MemoryWriteBarrier() {
+            asm volatile ("mf" ::: "memory");
+        }
+    #else 
+        inline void MemoryReadWriteBarrier() {
+            __asm__("mfence");
+        } 
+        inline void MemoryWriteBarrier() {
+            __asm__("sfence");
+        } 
+    #endif
+#else
+    #if defined (_IPF_)
+        inline void MemoryReadWriteBarrier() {
+            __asm mf;
+        }
+        inline void MemoryWriteBarrier() {
+            __asm mf;
+        }
+    #else
+        inline void MemoryReadWriteBarrier() {
+            __asm mfence;
+        }
+        inline void MemoryWriteBarrier() {
+            __asm sfence;
+        }
+    #endif
+#endif
+
+#endif // _ATOMICS_H_
+

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/version_svn_tag.h Mon Aug 14 20:46:26 2006
@@ -17,6 +17,6 @@
 #ifndef _VERSION_SVN_TAG_
 #define _VERSION_SVN_TAG_
 
-#define VERSION_SVN_TAG  "427663"
+#define VERSION_SVN_TAG  "431478"
 
 #endif // _VERSION_SVN_TAG_

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 14 20:46:26 2006
@@ -0,0 +1 @@
+bin

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/util/concurrent/Atomics.java Mon Aug 14 20:46:26 2006
@@ -1,136 +1,144 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/**
- * @author Artem A. Aliev, Andrey Y. Chernyshev, Sergey V. Dmitriev
- * @version $Revision: 1.1.6.3 $
- */
-package org.apache.harmony.util.concurrent;
-
-import java.lang.reflect.Field;
-
-/**
- * Allows to atomically update the contents of fields for the specific object. The primary purpose
- * of this class is to provide the low-level atomic field access operations useful for
- * implementing the classes from java.util.concurrent.atomic package.
- *
- * @see java.util.concurrent.atomic
- */
-public final class Atomics {
-
-    private Atomics() {};
-
-    /**
-     * Atomically sets an integer field to x if it currently contains the expected value.
-     * @param o object those integer field needs to be set
-     * @param field the field to be set
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetInt(Object o, Field field, int expected, int x);
-
-    /**
-     * Atomically sets a boolean field to x if it currently contains the expected value.
-     * @param o object those boolean field needs to be set
-     * @param field the field to be set
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetBoolean(Object o, Field field, boolean expected, boolean x);
-
-
-    /**
-     * Atomically sets a long field to x if it currently contains the expected value.
-     * @param o object those long field needs to be set
-     * @param field the field to be set
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetLong(Object o, Field field, long expected, long x);
-
-
-    /**
-     * Atomically sets a reference type field to x if it currently contains the expected value.
-     * @param o object those reference type field needs to be set
-     * @param field the field to be set
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetObject(Object o, Field field, Object expected, Object x);
-
-
-    /**
-     * Atomically sets an element within array of integers to x if it currently contains the expected value.
-     * @param arr array those integer element needs to be set
-     * @param index an index within an array
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetInt(int[] arr, int index, int expected, int x);
-
-
-    /**
-     * Atomically sets an element within array of booleans to x if it currently contains the expected value.
-     * @param arr array those boolean element needs to be set
-     * @param index an index within an array
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetBoolean(boolean[] arr, int index, boolean expected, boolean x);
-
-
-    /**
-     * Atomically sets an element within array of longs to x if it currently contains the expected value.
-     * @param arr array those long element needs to be set
-     * @param index an index within an array
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetLong(long[] arr, int index, long expected, long x);
-
-
-    /**
-     * Atomically sets an element within array of objects to x if it currently contains the expected value.
-     * @param arr array those object element needs to be set
-     * @param index an index within an array
-     * @param expected expected field value
-     * @param x value to set.
-     *
-     * @return true if the value was set.
-     * False return indicates that the actual value was not equal to the expected value.
-     */
-    public static native boolean compareAndSetObject(Object[] arr, int index, Object expected, Object x);
-}
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/**
+ * @author Artem A. Aliev, Andrey Y. Chernyshev, Sergey V. Dmitriev
+ * @version $Revision: 1.1.6.3 $
+ */
+package org.apache.harmony.util.concurrent;
+
+import java.lang.reflect.Field;
+
+/**
+ * Allows to atomically update the contents of fields for the specific object. The primary purpose
+ * of this class is to provide the low-level atomic field access operations useful for
+ * implementing the classes from java.util.concurrent.atomic package.
+ *
+ * @see java.util.concurrent.atomic
+ */
+public final class Atomics {
+
+    private Atomics() {};
+
+     /**
+      * Returns offset of the given field.
+      * @param field the field for which offset is returned
+      *
+      * @return offset of the given field
+      */
+    public static native long getFieldOffset(Field field);
+
+    /**
+     * Atomically sets an integer field to x if it currently contains the expected value.
+     * @param o object those integer field needs to be set
+     * @param field the field to be set
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetInt(Object o, long offset, int expected, int x);
+
+    /**
+     * Atomically sets a boolean field to x if it currently contains the expected value.
+     * @param o object those boolean field needs to be set
+     * @param field the field to be set
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetBoolean(Object o, long offset, boolean expected, boolean x);
+
+
+    /**
+     * Atomically sets a long field to x if it currently contains the expected value.
+     * @param o object those long field needs to be set
+     * @param field the field to be set
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetLong(Object o, long offset, long expected, long x);
+
+
+    /**
+     * Atomically sets a reference type field to x if it currently contains the expected value.
+     * @param o object those reference type field needs to be set
+     * @param field the field to be set
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetObject(Object o, long offset, Object expected, Object x);
+
+
+    /**
+     * Atomically sets an element within array of integers to x if it currently contains the expected value.
+     * @param arr array those integer element needs to be set
+     * @param index an index within an array
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetInt(int[] arr, int index, int expected, int x);
+
+
+    /**
+     * Atomically sets an element within array of booleans to x if it currently contains the expected value.
+     * @param arr array those boolean element needs to be set
+     * @param index an index within an array
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetBoolean(boolean[] arr, int index, boolean expected, boolean x);
+
+
+    /**
+     * Atomically sets an element within array of longs to x if it currently contains the expected value.
+     * @param arr array those long element needs to be set
+     * @param index an index within an array
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetLong(long[] arr, int index, long expected, long x);
+
+
+    /**
+     * Atomically sets an element within array of objects to x if it currently contains the expected value.
+     * @param arr array those object element needs to be set
+     * @param index an index within an array
+     * @param expected expected field value
+     * @param x value to set.
+     *
+     * @return true if the value was set.
+     * False return indicates that the actual value was not equal to the expected value.
+     */
+    public static native boolean compareAndSetObject(Object[] arr, int index, Object expected, Object x);
+}

Added: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java?rev=431519&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java Mon Aug 14 20:46:26 2006
@@ -0,0 +1,296 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package sun.misc;
+
+import java.lang.reflect.Field;
+import org.apache.harmony.util.concurrent.Atomics;
+
+/**
+ * <p>The Unsafe service.</p>
+ *
+ */
+public class Unsafe {
+
+    private static final Unsafe INSTANCE = new Unsafe();
+
+    private Unsafe() {
+    }
+
+    /**
+     * <p>
+     * Retrieves an instance of this service.
+     * </p>
+     * 
+     * @return An instance of Unsafe.
+     */
+    public static Unsafe getUnsafe() {
+        return INSTANCE;
+    }
+
+    /**
+     * <p>
+     * Retrieves the offset value of the {@link Field} for use by other methods
+     * in this class.
+     * </p>
+     * 
+     * @param field The {@link Field} to retrieve the offset for.
+     * @return The offset value.
+     */
+    public long objectFieldOffset(Field field) {
+        return Atomics.getFieldOffset(field);
+    }
+
+    /**
+     * <p>
+     * Compares and swaps the value of an int-typed field on an Object instance.
+     * </p>
+     * 
+     * @param object The instance containing the field.
+     * @param fieldOffset The offset value of the field.
+     * @param expected The expected value of the field.
+     * @param update The new value to write to the field.
+     * @return <code>true</code> if the field was updated, <code>false</code>
+     *         otherwise.
+     */
+    public boolean compareAndSwapInt(Object object, long fieldOffset, int expected, int update) {
+        return Atomics.compareAndSetInt(object, fieldOffset, expected, update);
+    }
+
+    /**
+     * <p>
+     * Compares and swaps the value of a long-typed field on an Object instance.
+     * </p>
+     * 
+     * @param object The instance containing the field.
+     * @param fieldOffset The offset value of the field.
+     * @param expected The expected value of the field.
+     * @param update The new value to write to the field.
+     * @return <code>true</code> if the field was updated, <code>false</code>
+     *         otherwise.
+     */
+    public boolean compareAndSwapLong(Object object, long fieldOffset, long expected,
+            long update) {
+        return Atomics.compareAndSetLong(object, fieldOffset, expected, update);
+    }
+
+    /**
+     * <p>
+     * Compares and swaps the value of an Object-typed field on an Object
+     * instance.
+     * </p>
+     * 
+     * @param object The instance containing the field.
+     * @param fieldOffset The offset value of the field.
+     * @param expected The expected value of the field.
+     * @param update The new value to write to the field.
+     * @return <code>true</code> if the field was updated, <code>false</code>
+     *         otherwise.
+     */
+    public boolean compareAndSwapObject(Object object, long fieldOffset, Object expected,
+            Object update) {
+        return Atomics.compareAndSetObject(object, fieldOffset, expected, update);
+    }
+
+    /**
+     * <p>
+     * Retrieves the base offset for the array Class given. The Class passed
+     * MUST me any array type, such that the method {@link Class#isArray()}
+     * returns <code>true</code>. For example, <code>int[].class</code>.
+     * </p>
+     * 
+     * @param clazz The array Class object.
+     * @return The base offset value.
+     */
+    public int arrayBaseOffset(Class<?> clazz) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Retrieves the array index scale for the array Class given. The index
+     * scale is the value used to determine the offset of a particular element
+     * in the array given the array's base offset and an index. The following
+     * code snippet illustrates the usage.
+     * </p>
+     * 
+     * <pre>
+     * int base = unsafe.arrayBaseOffset(int[].class);
+     * 
+     * int scale = unsafe.arrayIndexScale(int[].class);
+     * 
+     * int elementIdx = 1;
+     * 
+     * int[] array = { 0, 1, 2 };
+     * 
+     * long offsetForIdx = base + (elementIdx * scale);
+     * </pre>
+     * 
+     * <p>
+     * The Class passed MUST me any array type, such that the method
+     * {@link Class#isArray()} returns <code>true</code>. For example,
+     * <code>int[].class</code>.
+     * </p>
+     * 
+     * @param clazz The array Class object.
+     * @return The index scale value.
+     */
+    public int arrayIndexScale(Class<?> clazz) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Writes an int value to an Object's field as though it were declared
+     * <code>volatile</code>.
+     * </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 putIntVolatile(Object object, long fieldOffset, int newValue) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Reads an int value from an Object's field as though it were declared
+     * <code>volatile</code>.
+     * </p>
+     * 
+     * @param object The instance containing the field to read from.
+     * @param fieldOffset The offset of the field to read from.
+     * @return The value that was read.
+     */
+    public int getIntVolatile(Object object, long fieldOffset) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Writes a long value to an Object's field as though it were declared
+     * <code>volatile</code>.
+     * </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 putLongVolatile(Object object, long fieldOffset, long newValue) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Reads a long value from an Object's field as though it were declared
+     * <code>volatile</code>.
+     * </p>
+     * 
+     * @param object The instance containing the field to read from.
+     * @param fieldOffset The offset of the field to read from.
+     * @return The value that was read.
+     */
+    public long getLongVolatile(Object object, long fieldOffset) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Writes an Object reference value to an Object's field as though it were
+     * declared <code>volatile</code>.
+     * </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 putObjectVolatile(Object object, long fieldOffset, Object newValue) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Writes an int value to an Object's field as though it were declared
+     * <code>volatile</code>.
+     * </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 Object getObjectVolatile(Object object, long fieldOffset) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Writes a long 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 putLong(Object object, long fieldOffset, long newValue) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Reads a long value from an Object's field.
+     * </p>
+     * 
+     * @param object The instance containing the field to read from.
+     * @param fieldOffset The offset of the field to read from.
+     * @return The value that was read.
+     */
+    public long getLong(Object object, long fieldOffset) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Unparks the {@link Thread} that's passed.
+     * </p>
+     * 
+     * @param thread The {@link Thread} to unpark.
+     */
+    public void unpark(Thread thread) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+
+    /**
+     * <p>
+     * Parks the {@link Thread#currentThread() current thread} either for a set
+     * number of nanoseconds or until a future point in time.
+     * </p>
+     * 
+     * @param timestamp If <code>true</code> <code>nanosOrTimestamp</code>
+     *        should be consider as a timestamp based on
+     *        {@link System#currentTimeMillis()}. If <code>false</code>,
+     *        then <code>nanosOrTimestamp</code> should be considered as a
+     *        relative number of nanoseconds from when this method was called;
+     *        the value <code>0L</code> can be used in conjunction with this
+     *        to indicate that time is not a factor when parking the thread.
+     * @param nanosOrTimestamp Either a relative number of nanoseconds or a
+     *        timestamp in milliseconds as defined by
+     *        {@link System#currentTimeMillis()}.
+     */
+    public void park(boolean timestamp, long nanosOrTimestamp) {
+        throw new UnsupportedOperationException("Not Yet Implemented");
+    }
+}

Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/sun/misc/Unsafe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.cpp Mon Aug 14 20:46:26 2006
@@ -1,87 +1,94 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/** 
- * @author Andrey Chernyshev
- * @version $Revision: 1.1.6.4 $
- */  
-
-#include "jni.h"
-#include "atomics.h"
-#include "org_apache_harmony_util_concurrent_Atomics.h"
-
-
-JNIEXPORT jboolean JNICALL 
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject__Ljava_lang_Object_2Ljava_lang_reflect_Field_2Ljava_lang_Object_2Ljava_lang_Object_2
-(JNIEnv * env, jobject self, jobject obj, jobject fieldID, jobject expected, jobject value)
-{     
-    return compareAndSetObjectField(env, self, obj, fieldID, expected, value);
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean__Ljava_lang_Object_2Ljava_lang_reflect_Field_2ZZ
-(JNIEnv * env, jobject self, jobject obj, jobject fieldID, jboolean expected, jboolean value)
-{
-    return compareAndSetBooleanField(env, self, obj, fieldID, expected, value);
-}
-
-                  
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt__Ljava_lang_Object_2Ljava_lang_reflect_Field_2II
-(JNIEnv * env, jobject self, jobject obj, jobject fieldID, jint expected, jint value)
-{     
-    return compareAndSetIntField(env, self, obj, fieldID, expected, value);
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong__Ljava_lang_Object_2Ljava_lang_reflect_Field_2JJ
-(JNIEnv * env, jobject self, jobject obj, jobject fieldID, jlong expected, jlong value)
-{     
-    return compareAndSetLongField(env, self, obj, fieldID, expected, value);
-}
- 
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt___3IIII
-(JNIEnv * env, jobject self, jintArray array, jint index, jint expected, jint value)
-{
-    return compareAndSetIntArray(env, self, array, index, expected, value);
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean___3ZIZZ
-(JNIEnv * env, jobject self, jbooleanArray array, jint index, jboolean expected, jboolean value)
-{
-    return compareAndSetBooleanArray(env, self, array, index, expected, value);
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong___3JIJJ
-(JNIEnv * env, jobject self, jlongArray array, jint index, jlong expected, jlong value)
-{
-    return compareAndSetLongArray(env, self, array, index, expected, value);
-}
-
-
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject___3Ljava_lang_Object_2ILjava_lang_Object_2Ljava_lang_Object_2
-(JNIEnv * env, jobject self, jobjectArray array, jint index, jobject expected, jobject value)
-{
-    return compareAndSetObjectArray(env, self, array, index, expected, value);
-}
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Andrey Chernyshev
+ * @version $Revision: 1.1.6.4 $
+ */  
+
+#include "jni.h"
+#include "atomics.h"
+#include "org_apache_harmony_util_concurrent_Atomics.h"
+
+
+JNIEXPORT jlong JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_getFieldOffset(JNIEnv * env, jclass self, 
+    jobject field)
+{
+    return getFieldOffset(env, field);
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject__Ljava_lang_Object_2JLjava_lang_Object_2Ljava_lang_Object_2
+(JNIEnv * env, jobject self, jobject obj, jlong offset, jobject expected, jobject value)
+{     
+    return compareAndSetObjectField(env, self, obj, offset, expected, value);
+}
+ 
+ 
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean__Ljava_lang_Object_2JZZ 
+(JNIEnv * env, jobject self, jobject obj, jlong offset, jboolean expected, jboolean value)
+{
+    return compareAndSetBooleanField(env, self, obj, offset, expected, value);
+}
+ 
+                   
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt__Ljava_lang_Object_2JII 
+(JNIEnv * env, jobject self, jobject obj, jlong offset, jint expected, jint value)
+{     
+    return compareAndSetIntField(env, self, obj, offset, expected, value);
+}
+ 
+ 
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong__Ljava_lang_Object_2JJJ 
+(JNIEnv * env, jobject self, jobject obj, jlong offset, jlong expected, jlong value)
+{     
+    return compareAndSetLongField(env, self, obj, offset, expected, value);
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt___3IIII
+(JNIEnv * env, jobject self, jintArray array, jint index, jint expected, jint value)
+{
+    return compareAndSetIntArray(env, self, array, index, expected, value);
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean___3ZIZZ
+(JNIEnv * env, jobject self, jbooleanArray array, jint index, jboolean expected, jboolean value)
+{
+    return compareAndSetBooleanArray(env, self, array, index, expected, value);
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong___3JIJJ
+(JNIEnv * env, jobject self, jlongArray array, jint index, jlong expected, jlong value)
+{
+    return compareAndSetLongArray(env, self, array, index, expected, value);
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject___3Ljava_lang_Object_2ILjava_lang_Object_2Ljava_lang_Object_2
+(JNIEnv * env, jobject self, jobjectArray array, jint index, jobject expected, jobject value)
+{
+    return compareAndSetObjectArray(env, self, array, index, expected, value);
+}

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/native/org_apache_harmony_util_concurrent_Atomics.h Mon Aug 14 20:46:26 2006
@@ -1,105 +1,111 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/** 
- * @author Andrey Chernyshev
- * @version $Revision: 1.1.6.5 $
- */  
-
-/*
- * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL.
- * Please be aware that all changes made to this file manually
- * will be overwritten by the tool if it runs again.
- */
-
-#include <jni.h>
-
-
-/* Header for class org.apache.harmony.util.concurrent.Atomics */
-
-#ifndef _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H
-#define _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Native methods */
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetInt(Ljava/lang/Object;Ljava/lang/reflect/Field;II)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt__Ljava_lang_Object_2Ljava_lang_reflect_Field_2II(JNIEnv *, jclass, 
-    jobject, jobject, jint, jint);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetBoolean(Ljava/lang/Object;Ljava/lang/reflect/Field;ZZ)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean__Ljava_lang_Object_2Ljava_lang_reflect_Field_2ZZ(JNIEnv *, jclass, 
-    jobject, jobject, jboolean, jboolean);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetLong(Ljava/lang/Object;Ljava/lang/reflect/Field;JJ)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong__Ljava_lang_Object_2Ljava_lang_reflect_Field_2JJ(JNIEnv *, jclass, 
-    jobject, jobject, jlong, jlong);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetObject(Ljava/lang/Object;Ljava/lang/reflect/Field;Ljava/lang/Object;Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject__Ljava_lang_Object_2Ljava_lang_reflect_Field_2Ljava_lang_Object_2Ljava_lang_Object_2(JNIEnv *, jclass, 
-    jobject, jobject, jobject, jobject);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetInt([IIII)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt___3IIII(JNIEnv *, jclass, 
-    jintArray, jint, jint, jint);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetBoolean([ZIZZ)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean___3ZIZZ(JNIEnv *, jclass, 
-    jbooleanArray, jint, jboolean, jboolean);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetLong([JIJJ)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong___3JIJJ(JNIEnv *, jclass, 
-    jlongArray, jint, jlong, jlong);
-
-/*
- * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetObject([Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject___3Ljava_lang_Object_2ILjava_lang_Object_2Ljava_lang_Object_2(JNIEnv *, jclass, 
-    jobjectArray, jint, jobject, jobject);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H */
-
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/** 
+ * @author Andrey Chernyshev
+ * @version $Revision: 1.1.6.5 $
+ */  
+
+/*
+ * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL.
+ * Please be aware that all changes made to this file manually
+ * will be overwritten by the tool if it runs again.
+ */
+
+#include <jni.h>
+
+
+/* Header for class org.apache.harmony.util.concurrent.Atomics */
+
+#ifndef _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H
+#define _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Native methods */
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.getFieldOffset(Ljava/lang/reflect/Field;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_getFieldOffset(JNIEnv *, jclass, jobject);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetInt(Ljava/lang/Object;JII)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt__Ljava_lang_Object_2JII(JNIEnv *, jclass, 
+    jobject, jlong, jint, jint);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetBoolean(Ljava/lang/Object;JZZ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean__Ljava_lang_Object_2JZZ(JNIEnv *, jclass, 
+    jobject, jlong, jboolean, jboolean);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetLong(Ljava/lang/Object;JJJ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong__Ljava_lang_Object_2JJJ(JNIEnv *, jclass, 
+    jobject, jlong, jlong, jlong);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject__Ljava_lang_Object_2JLjava_lang_Object_2Ljava_lang_Object_2(JNIEnv *, jclass, 
+    jobject, jlong, jobject, jobject);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetInt([IIII)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetInt___3IIII(JNIEnv *, jclass, 
+    jintArray, jint, jint, jint);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetBoolean([ZIZZ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetBoolean___3ZIZZ(JNIEnv *, jclass, 
+    jbooleanArray, jint, jboolean, jboolean);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetLong([JIJJ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetLong___3JIJJ(JNIEnv *, jclass, 
+    jlongArray, jint, jlong, jlong);
+
+/*
+ * Method: org.apache.harmony.util.concurrent.Atomics.compareAndSetObject([Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_org_apache_harmony_util_concurrent_Atomics_compareAndSetObject___3Ljava_lang_Object_2ILjava_lang_Object_2Ljava_lang_Object_2(JNIEnv *, jclass, 
+    jobjectArray, jint, jobject, jobject);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ORG_APACHE_HARMONY_UTIL_CONCURRENT_ATOMICS_H */
+

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/atomics.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/atomics.cpp?rev=431519&r1=431518&r2=431519&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/atomics.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/atomics.cpp Mon Aug 14 20:46:26 2006
@@ -1,267 +1,263 @@
-/*
- *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-/** 
- * @author Andrey Chernyshev
- * @version $Revision: 1.1.2.1.4.4 $
- */  
-
-#include <apr_atomic.h>
-
-#include "jni.h"
-#include "Class.h"
-#include "object_handles.h"
-#include "environment.h"
-#include "atomics.h"
-#include "vm_arrays.h"
-#include "port_atomic.h"
-#include "open/thread.h"
-
-/*
- * Common atomic functions.
- * Platform dependent atomic functions are in corresponding arch/ subfolders.
- */
-
-bool gc_heap_slot_cas_ref_compressed (Managed_Object_Handle p_base_of_object_with_slot,
-                                      COMPRESSED_REFERENCE *p_slot,
-                                      Managed_Object_Handle expected,
-                                      Managed_Object_Handle value)
-{
-    assert (p_base_of_object_with_slot != NULL);
-
-    COMPRESSED_REFERENCE compressed_expected = compress_reference((ManagedObject*)expected);
-    COMPRESSED_REFERENCE compressed_value = compress_reference((ManagedObject*)value);
-
-    bool result =
-        (apr_atomic_cas32(
-            (uint32*)p_slot, (uint32)compressed_value, (uint32)compressed_expected)
-        == (uint32)compressed_expected);
-
-    // TODO: uncomment foolowing line for GC
-    //INTERNAL(gc_write_barrier) (p_base_of_object_with_slot);
-    return result;
-}
-
-
-bool gc_heap_slot_cas_ref (Managed_Object_Handle p_base_of_object_with_slot,
-                           Managed_Object_Handle *p_slot,
-                           Managed_Object_Handle expected,
-                           Managed_Object_Handle value)
-{
-    assert (p_base_of_object_with_slot != NULL);
-    bool res = (apr_atomic_casptr (
-        (volatile void **)p_slot, value, expected) == expected);
-    // TODO: uncomment foolowing line for GC 
-    //INTERNAL(gc_write_barrier) (p_base_of_object_with_slot);
-    return res;
-}
-
-
-jlong getFieldOffset (JNIEnv *env, jobject field) {
-    Field *f = (Field *) FromReflectedField(env, field);
-    return f->get_offset();
-}
-
-
-JNIEXPORT jboolean compareAndSetObjectField
-(JNIEnv * env, jobject UNREF accesor, jobject obj, jobject fieldID, jobject expected, jobject value)
-{
-
-    assert(tmn_is_suspend_enabled());
-    jlong offset = getFieldOffset(env, fieldID);
-
-    ObjectHandle h = (ObjectHandle)obj;
-    ObjectHandle v = (ObjectHandle)value;
-    ObjectHandle e = (ObjectHandle)expected;
-
-    tmn_suspend_disable();
-
-    Byte *java_ref = (Byte *)h->object;
-    ManagedObject **field_addr = (ManagedObject **)(java_ref + offset);
-
-    ManagedObject *val = (v==NULL)?NULL:v->object;
-    ManagedObject *exp = (e==NULL)?NULL:e->object;
-
-    bool result;
-
-    if (VM_Global_State::loader_env->compress_references) {
-        result = gc_heap_slot_cas_ref_compressed((Managed_Object_Handle)(java_ref),
-                                                 (COMPRESSED_REFERENCE *)(field_addr),
-                                                 (Managed_Object_Handle)(exp),
-                                                 (Managed_Object_Handle)(val));
-    }
-    else
-    {
-        result = gc_heap_slot_cas_ref((Managed_Object_Handle)(java_ref),
-                                      (Managed_Object_Handle *)(field_addr),
-                                      (Managed_Object_Handle)(exp),
-                                      (Managed_Object_Handle)(val));
-    }
-
-    tmn_suspend_enable();
-    return  (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-
-JNIEXPORT jboolean compareAndSetBooleanField
-(JNIEnv * env, jobject UNREF accesor, jobject obj, jobject fieldID, jboolean expected, jboolean value)
-{
-    assert(tmn_is_suspend_enabled());
-    jlong offset = getFieldOffset(env, fieldID);
-    ObjectHandle h = (ObjectHandle)obj;
-
-    tmn_suspend_disable();
-
-    Byte *java_ref = (Byte *)h->object;
-    jboolean *field_addr = (jboolean *)(java_ref + offset);
-    bool result =
-        (port_atomic_cas8((uint8 *)field_addr, (uint8)value, (uint8)expected) == (uint8)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-                  
-JNIEXPORT jboolean compareAndSetIntField
-(JNIEnv * env, jobject UNREF accesor, jobject obj, jobject fieldID, jint expected, jint value)
-{
-
-    assert(tmn_is_suspend_enabled());
-    jlong offset = getFieldOffset(env, fieldID);
-    ObjectHandle h = (ObjectHandle)obj;
-
-    tmn_suspend_disable();
-
-    Byte *java_ref = (Byte *)h->object;
-    jint *field_addr = (jint *)(java_ref + offset);
-    bool result =
-      (apr_atomic_cas32((uint32 *)field_addr, (uint32)value, (uint32)expected) == (uint32)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-
-JNIEXPORT jboolean compareAndSetLongField
-(JNIEnv * env, jobject UNREF accesor, jobject obj, jobject fieldID, jlong expected, jlong value)
-{
-    assert(tmn_is_suspend_enabled());
-    jlong offset = getFieldOffset(env, fieldID);
-    ObjectHandle h = (ObjectHandle)obj;
-
-    tmn_suspend_disable();
-
-    Byte *java_ref = (Byte *)h->object;
-    jlong *field_addr = (jlong *)(java_ref + offset);
-
-    bool result =
-      (port_atomic_cas64((uint64 *)field_addr, (uint64)value, (uint64)expected) == (uint64)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-
-JNIEXPORT jboolean compareAndSetObjectArray
-(JNIEnv * UNREF env, jobject UNREF self, jobjectArray array, jint index, jobject expected, jobject value)
-{
-    assert(tmn_is_suspend_enabled());
-
-    tmn_suspend_disable();
-
-    Vector_Handle vector_handle = (Vector_Handle) ((ObjectHandle) array)->object;
-
-    ManagedObject ** element_address =
-            get_vector_element_address_ref(vector_handle, index);
-
-    ManagedObject *exp = (expected==NULL) ? NULL : ((ObjectHandle) expected)->object;
-    ManagedObject *val = (value==NULL) ? NULL : ((ObjectHandle) value)->object;
-
-    bool result;
-
-    if (VM_Global_State::loader_env->compress_references) {
-        result = gc_heap_slot_cas_ref_compressed((Managed_Object_Handle)(vector_handle),
-                                                 (COMPRESSED_REFERENCE *)(element_address),
-                                                 (Managed_Object_Handle)(exp),
-                                                 (Managed_Object_Handle)(val));
-    }
-    else
-    {
-        result = gc_heap_slot_cas_ref((Managed_Object_Handle)(vector_handle),
-                                      (Managed_Object_Handle *)(element_address),
-                                      (Managed_Object_Handle)(exp),
-                                      (Managed_Object_Handle)(val));
-    }
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-
-JNIEXPORT jboolean compareAndSetBooleanArray
-(JNIEnv * UNREF env, jobject UNREF self, jbooleanArray array, jint index, jboolean expected, jboolean value)
-{
-    assert(tmn_is_suspend_enabled());
-
-    tmn_suspend_disable();
-
-    jboolean * field_addr = (jboolean *) get_vector_element_address_int8(
-            (Vector_Handle) ((ObjectHandle) array)->object,
-            index);
-
-    bool result =
-        (port_atomic_cas8((uint8 *)field_addr, (uint8)value, (uint8)expected) == (uint8)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-                  
-JNIEXPORT jboolean compareAndSetIntArray
-(JNIEnv * UNREF env, jobject UNREF self, jintArray array, jint index, jint expected, jint value)
-{
-    assert(tmn_is_suspend_enabled());
-
-    tmn_suspend_disable();
-
-    jint * field_addr = get_vector_element_address_int32(
-            (Vector_Handle) ((ObjectHandle) array)->object,
-            index);
-
-    bool result =
-      (apr_atomic_cas32((uint32 *)field_addr, (uint32)value, (uint32)expected) == (uint32)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
-
-
-JNIEXPORT jboolean compareAndSetLongArray
-(JNIEnv * UNREF env, jobject UNREF self, jlongArray array, jint index, jlong expected, jlong value)
-{
-    assert(tmn_is_suspend_enabled());
-
-    tmn_suspend_disable();
-
-    jlong * field_addr = get_vector_element_address_int64(
-            (Vector_Handle) ((ObjectHandle) array)->object,
-            index);
-
-    bool result =
-      (port_atomic_cas64((uint64 *)field_addr, (uint64)value, (uint64)expected) == (uint64)expected);
-
-    tmn_suspend_enable();
-    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
-}
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+/** 
+ * @author Andrey Chernyshev
+ * @version $Revision: 1.1.2.1.4.4 $
+ */  
+
+#include <apr_atomic.h>
+
+#include "jni.h"
+#include "Class.h"
+#include "object_handles.h"
+#include "environment.h"
+#include "atomics.h"
+#include "vm_arrays.h"
+#include "port_atomic.h"
+#include "open/thread.h"
+
+/*
+ * Common atomic functions.
+ * Platform dependent atomic functions are in corresponding arch/ subfolders.
+ */
+
+bool gc_heap_slot_cas_ref_compressed (Managed_Object_Handle p_base_of_object_with_slot,
+                                      COMPRESSED_REFERENCE *p_slot,
+                                      Managed_Object_Handle expected,
+                                      Managed_Object_Handle value)
+{
+    assert (p_base_of_object_with_slot != NULL);
+
+    COMPRESSED_REFERENCE compressed_expected = compress_reference((ManagedObject*)expected);
+    COMPRESSED_REFERENCE compressed_value = compress_reference((ManagedObject*)value);
+
+    bool result =
+        (apr_atomic_cas32(
+            (uint32*)p_slot, (uint32)compressed_value, (uint32)compressed_expected)
+        == (uint32)compressed_expected);
+
+    // TODO: uncomment foolowing line for GC
+    //INTERNAL(gc_write_barrier) (p_base_of_object_with_slot);
+    return result;
+}
+
+
+bool gc_heap_slot_cas_ref (Managed_Object_Handle p_base_of_object_with_slot,
+                           Managed_Object_Handle *p_slot,
+                           Managed_Object_Handle expected,
+                           Managed_Object_Handle value)
+{
+    assert (p_base_of_object_with_slot != NULL);
+    bool res = (apr_atomic_casptr (
+        (volatile void **)p_slot, value, expected) == expected);
+    // TODO: uncomment foolowing line for GC 
+    //INTERNAL(gc_write_barrier) (p_base_of_object_with_slot);
+    return res;
+}
+
+
+JNIEXPORT jlong getFieldOffset(JNIEnv * env, jobject field) 
+{
+    Field *f = (Field *) FromReflectedField(env, field);
+    return f->get_offset();
+}
+
+JNIEXPORT jboolean compareAndSetObjectField
+(JNIEnv * env, jobject UNREF accesor, jobject obj, jlong offset, jobject expected, jobject value)
+{
+
+    assert(tmn_is_suspend_enabled());
+
+    ObjectHandle h = (ObjectHandle)obj;
+    ObjectHandle v = (ObjectHandle)value;
+    ObjectHandle e = (ObjectHandle)expected;
+
+    tmn_suspend_disable();
+
+    Byte *java_ref = (Byte *)h->object;
+    ManagedObject **field_addr = (ManagedObject **)(java_ref + offset);
+
+    ManagedObject *val = (v==NULL)?NULL:v->object;
+    ManagedObject *exp = (e==NULL)?NULL:e->object;
+
+    bool result;
+
+    if (VM_Global_State::loader_env->compress_references) {
+        result = gc_heap_slot_cas_ref_compressed((Managed_Object_Handle)(java_ref),
+                                                 (COMPRESSED_REFERENCE *)(field_addr),
+                                                 (Managed_Object_Handle)(exp),
+                                                 (Managed_Object_Handle)(val));
+    }
+    else
+    {
+        result = gc_heap_slot_cas_ref((Managed_Object_Handle)(java_ref),
+                                      (Managed_Object_Handle *)(field_addr),
+                                      (Managed_Object_Handle)(exp),
+                                      (Managed_Object_Handle)(val));
+    }
+
+    tmn_suspend_enable();
+    return  (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+
+JNIEXPORT jboolean compareAndSetBooleanField
+(JNIEnv * env, jobject UNREF accesor, jobject obj, jlong offset, jboolean expected, jboolean value)
+{
+    assert(tmn_is_suspend_enabled());
+    ObjectHandle h = (ObjectHandle)obj;
+
+    tmn_suspend_disable();
+
+    Byte *java_ref = (Byte *)h->object;
+    jboolean *field_addr = (jboolean *)(java_ref + offset);
+    bool result =
+        (port_atomic_cas8((uint8 *)field_addr, (uint8)value, (uint8)expected) == (uint8)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+                  
+JNIEXPORT jboolean compareAndSetIntField
+(JNIEnv * env, jobject UNREF accesor, jobject obj, jlong offset, jint expected, jint value)
+{
+
+    assert(tmn_is_suspend_enabled());
+    ObjectHandle h = (ObjectHandle)obj;
+
+    tmn_suspend_disable();
+
+    Byte *java_ref = (Byte *)h->object;
+    jint *field_addr = (jint *)(java_ref + offset);
+    bool result =
+      (apr_atomic_cas32((uint32 *)field_addr, (uint32)value, (uint32)expected) == (uint32)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+
+JNIEXPORT jboolean compareAndSetLongField
+(JNIEnv * env, jobject UNREF accesor, jobject obj, jlong offset, jlong expected, jlong value)
+{
+    assert(tmn_is_suspend_enabled());
+    ObjectHandle h = (ObjectHandle)obj;
+
+    tmn_suspend_disable();
+
+    Byte *java_ref = (Byte *)h->object;
+    jlong *field_addr = (jlong *)(java_ref + offset);
+
+    bool result =
+      (port_atomic_cas64((uint64 *)field_addr, (uint64)value, (uint64)expected) == (uint64)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+
+JNIEXPORT jboolean compareAndSetObjectArray
+(JNIEnv * UNREF env, jobject UNREF self, jobjectArray array, jint index, jobject expected, jobject value)
+{
+    assert(tmn_is_suspend_enabled());
+
+    tmn_suspend_disable();
+
+    Vector_Handle vector_handle = (Vector_Handle) ((ObjectHandle) array)->object;
+
+    ManagedObject ** element_address =
+            get_vector_element_address_ref(vector_handle, index);
+
+    ManagedObject *exp = (expected==NULL) ? NULL : ((ObjectHandle) expected)->object;
+    ManagedObject *val = (value==NULL) ? NULL : ((ObjectHandle) value)->object;
+
+    bool result;
+
+    if (VM_Global_State::loader_env->compress_references) {
+        result = gc_heap_slot_cas_ref_compressed((Managed_Object_Handle)(vector_handle),
+                                                 (COMPRESSED_REFERENCE *)(element_address),
+                                                 (Managed_Object_Handle)(exp),
+                                                 (Managed_Object_Handle)(val));
+    }
+    else
+    {
+        result = gc_heap_slot_cas_ref((Managed_Object_Handle)(vector_handle),
+                                      (Managed_Object_Handle *)(element_address),
+                                      (Managed_Object_Handle)(exp),
+                                      (Managed_Object_Handle)(val));
+    }
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+
+JNIEXPORT jboolean compareAndSetBooleanArray
+(JNIEnv * UNREF env, jobject UNREF self, jbooleanArray array, jint index, jboolean expected, jboolean value)
+{
+    assert(tmn_is_suspend_enabled());
+
+    tmn_suspend_disable();
+
+    jboolean * field_addr = (jboolean *) get_vector_element_address_int8(
+            (Vector_Handle) ((ObjectHandle) array)->object,
+            index);
+
+    bool result =
+        (port_atomic_cas8((uint8 *)field_addr, (uint8)value, (uint8)expected) == (uint8)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+                  
+JNIEXPORT jboolean compareAndSetIntArray
+(JNIEnv * UNREF env, jobject UNREF self, jintArray array, jint index, jint expected, jint value)
+{
+    assert(tmn_is_suspend_enabled());
+
+    tmn_suspend_disable();
+
+    jint * field_addr = get_vector_element_address_int32(
+            (Vector_Handle) ((ObjectHandle) array)->object,
+            index);
+
+    bool result =
+      (apr_atomic_cas32((uint32 *)field_addr, (uint32)value, (uint32)expected) == (uint32)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}
+
+
+JNIEXPORT jboolean compareAndSetLongArray
+(JNIEnv * UNREF env, jobject UNREF self, jlongArray array, jint index, jlong expected, jlong value)
+{
+    assert(tmn_is_suspend_enabled());
+
+    tmn_suspend_disable();
+
+    jlong * field_addr = get_vector_element_address_int64(
+            (Vector_Handle) ((ObjectHandle) array)->object,
+            index);
+
+    bool result =
+      (port_atomic_cas64((uint64 *)field_addr, (uint64)value, (uint64)expected) == (uint64)expected);
+
+    tmn_suspend_enable();
+    return (jboolean)(result?JNI_TRUE:JNI_FALSE);
+}



Mime
View raw message