move Unsafe.putObjectVolatile and putOrderedObject implementations

This makes them available to all class libraries, not just OpenJDK.
This commit is contained in:
Joel Dice 2014-01-02 18:00:53 -07:00
parent cc5b58725a
commit 789c36a459
3 changed files with 24 additions and 20 deletions

View File

@ -60,6 +60,10 @@ public final class Unsafe {
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 File

@ -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 File

@ -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*)