[llvm-commits] [vmkit] r52322 - /vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Jun 16 07:06:45 PDT 2008
Author: geoffray
Date: Mon Jun 16 09:06:44 2008
New Revision: 52322
URL: http://llvm.org/viewvc/llvm-project?rev=52322&view=rev
Log:
Implement compareAndSwapInt and compareAndSwapObject.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
Modified: vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp?rev=52322&r1=52321&r2=52322&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/Classpath.cpp Mon Jun 16 09:06:44 2008
@@ -207,4 +207,30 @@
}
+JNIEXPORT bool JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(
+#ifdef NATIVE_JNI
+ JNIEnv *env,
+#endif
+ JavaObject* unsafe, JavaObject* obj, jlong offset, jint expect, jint update) {
+
+ jint *ptr;
+
+ ptr = (jint *) (((uint8 *) obj) + offset);
+
+ return __sync_bool_compare_and_swap(ptr, expect, update);
+}
+
+JNIEXPORT bool JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(
+#ifdef NATIVE_JNI
+ JNIEnv *env,
+#endif
+ JavaObject* unsafe, JavaObject* obj, jlong offset, jobject expect, jobject update) {
+
+ jobject *ptr;
+
+ ptr = (jobject *) (((uint8 *) obj) + offset);
+
+ return __sync_bool_compare_and_swap(ptr, expect, update);
+}
+
}
More information about the llvm-commits
mailing list