Permalink
Browse files

move Unsafe.putObjectVolatile and putOrderedObject implementations

This makes them available to all class libraries, not just OpenJDK.
  • Loading branch information...
dicej committed Jan 3, 2014
1 parent cc5b587 commit 789c36a4599727e5ac4f99f9f9cc51297ac6f286
Showing with 24 additions and 20 deletions.
  1. +4 −0 classpath/sun/misc/Unsafe.java
  2. +20 −0 src/builtin.cpp
  3. +0 −20 src/classpath-openjdk.cpp
@@ -60,6 +60,10 @@ public static Unsafe getUnsafe() {
public native void putObject(Object o, long offset, Object x);
+ public native void putObjectVolatile(Object o, long offset, Object x);
+
+ public native void putOrderedObject(Object o, long offset, Object x);
+
public native long getAddress(long address);
public native void putAddress(long address, long x);
View
@@ -703,6 +703,26 @@ Avian_sun_misc_Unsafe_putObject
set(t, o, offset, reinterpret_cast<object>(value));
}
+extern "C" AVIAN_EXPORT void JNICALL
+Avian_sun_misc_Unsafe_putObjectVolatile
+(Thread* t, object, uintptr_t* arguments)
+{
+ object o = reinterpret_cast<object>(arguments[1]);
+ int64_t offset; memcpy(&offset, arguments + 2, 8);
+ object value = reinterpret_cast<object>(arguments[4]);
+
+ storeStoreMemoryBarrier();
+ set(t, o, offset, reinterpret_cast<object>(value));
+ storeLoadMemoryBarrier();
+}
+
+extern "C" AVIAN_EXPORT void JNICALL
+Avian_sun_misc_Unsafe_putOrderedObject
+(Thread* t, object method, uintptr_t* arguments)
+{
+ Avian_sun_misc_Unsafe_putObjectVolatile(t, method, arguments);
+}
+
extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_sun_misc_Unsafe_compareAndSwapObject
(Thread* t, object, uintptr_t* arguments)
View
@@ -2794,26 +2794,6 @@ Avian_sun_misc_Unsafe_getObjectVolatile
return value;
}
-extern "C" AVIAN_EXPORT void JNICALL
-Avian_sun_misc_Unsafe_putObjectVolatile
-(Thread* t, object, uintptr_t* arguments)
-{
- object o = reinterpret_cast<object>(arguments[1]);
- int64_t offset; memcpy(&offset, arguments + 2, 8);
- object value = reinterpret_cast<object>(arguments[4]);
-
- storeStoreMemoryBarrier();
- set(t, o, offset, reinterpret_cast<object>(value));
- storeLoadMemoryBarrier();
-}
-
-extern "C" AVIAN_EXPORT void JNICALL
-Avian_sun_misc_Unsafe_putOrderedObject
-(Thread* t, object method, uintptr_t* arguments)
-{
- Avian_sun_misc_Unsafe_putObjectVolatile(t, method, arguments);
-}
-
extern "C" AVIAN_EXPORT int64_t JNICALL
Avian_sun_misc_Unsafe_pageSize
(Thread*, object, uintptr_t*)

0 comments on commit 789c36a

Please sign in to comment.