mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
move Unsafe.get{Object|Int}Volatile from classpath-openjdk.cpp to builtin.cpp
This makes them available in all class libraries, not just the OpenJDK
library. Note that I've also removed the unecessary idle statements,
per ab4adef
.
This commit is contained in:
parent
1cd822b23e
commit
0a89683eff
@ -46,6 +46,8 @@ public final class Unsafe {
|
|||||||
|
|
||||||
public native void putDouble(long address, double x);
|
public native void putDouble(long address, double x);
|
||||||
|
|
||||||
|
public native int getIntVolatile(Object o, long offset);
|
||||||
|
|
||||||
public native void putIntVolatile(Object o, long offset, int x);
|
public native void putIntVolatile(Object o, long offset, int x);
|
||||||
|
|
||||||
public native long getLongVolatile(Object o, long offset);
|
public native long getLongVolatile(Object o, long offset);
|
||||||
@ -64,6 +66,8 @@ public final class Unsafe {
|
|||||||
|
|
||||||
public native void putOrderedObject(Object o, long offset, Object x);
|
public native void putOrderedObject(Object o, long offset, Object x);
|
||||||
|
|
||||||
|
public native Object getObjectVolatile(Object o, long offset);
|
||||||
|
|
||||||
public native long getAddress(long address);
|
public native long getAddress(long address);
|
||||||
|
|
||||||
public native void putAddress(long address, long x);
|
public native void putAddress(long address, long x);
|
||||||
|
@ -723,6 +723,18 @@ Avian_sun_misc_Unsafe_putOrderedObject
|
|||||||
Avian_sun_misc_Unsafe_putObjectVolatile(t, method, arguments);
|
Avian_sun_misc_Unsafe_putObjectVolatile(t, method, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
|
Avian_sun_misc_Unsafe_getObjectVolatile
|
||||||
|
(Thread*, object, uintptr_t* arguments)
|
||||||
|
{
|
||||||
|
object o = reinterpret_cast<object>(arguments[1]);
|
||||||
|
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||||
|
|
||||||
|
uintptr_t value = fieldAtOffset<uintptr_t>(o, offset);
|
||||||
|
loadMemoryBarrier();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
Avian_sun_misc_Unsafe_compareAndSwapObject
|
Avian_sun_misc_Unsafe_compareAndSwapObject
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
@ -916,6 +928,18 @@ Avian_sun_misc_Unsafe_putOrderedInt
|
|||||||
Avian_sun_misc_Unsafe_putIntVolatile(t, method, arguments);
|
Avian_sun_misc_Unsafe_putIntVolatile(t, method, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
|
Avian_sun_misc_Unsafe_getIntVolatile
|
||||||
|
(Thread*, object, uintptr_t* arguments)
|
||||||
|
{
|
||||||
|
object o = reinterpret_cast<object>(arguments[1]);
|
||||||
|
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
||||||
|
|
||||||
|
int32_t result = fieldAtOffset<int32_t>(o, offset);
|
||||||
|
loadMemoryBarrier();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT void JNICALL
|
extern "C" AVIAN_EXPORT void JNICALL
|
||||||
Avian_sun_misc_Unsafe_throwException
|
Avian_sun_misc_Unsafe_throwException
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
|
@ -2640,22 +2640,6 @@ Avian_sun_misc_Unsafe_getFloat__Ljava_lang_Object_2J
|
|||||||
return fieldAtOffset<int32_t>(o, offset);
|
return fieldAtOffset<int32_t>(o, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
|
||||||
Avian_sun_misc_Unsafe_getIntVolatile
|
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
|
||||||
{
|
|
||||||
object o = reinterpret_cast<object>(arguments[1]);
|
|
||||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
|
||||||
|
|
||||||
// avoid blocking the VM if this is being called in a busy loop
|
|
||||||
PROTECT(t, o);
|
|
||||||
{ ENTER(t, Thread::IdleState); }
|
|
||||||
|
|
||||||
int32_t result = fieldAtOffset<int32_t>(o, offset);
|
|
||||||
loadMemoryBarrier();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
Avian_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J
|
Avian_sun_misc_Unsafe_getLong__Ljava_lang_Object_2J
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
@ -2769,22 +2753,6 @@ Avian_sun_misc_Unsafe_putLong__Ljava_lang_Object_2JJ
|
|||||||
fieldAtOffset<int64_t>(o, offset) = value;
|
fieldAtOffset<int64_t>(o, offset) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
|
||||||
Avian_sun_misc_Unsafe_getObjectVolatile
|
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
|
||||||
{
|
|
||||||
object o = reinterpret_cast<object>(arguments[1]);
|
|
||||||
int64_t offset; memcpy(&offset, arguments + 2, 8);
|
|
||||||
|
|
||||||
// avoid blocking the VM if this is being called in a busy loop
|
|
||||||
PROTECT(t, o);
|
|
||||||
{ ENTER(t, Thread::IdleState); }
|
|
||||||
|
|
||||||
uintptr_t value = fieldAtOffset<uintptr_t>(o, offset);
|
|
||||||
loadMemoryBarrier();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
Avian_sun_misc_Unsafe_pageSize
|
Avian_sun_misc_Unsafe_pageSize
|
||||||
(Thread*, object, uintptr_t*)
|
(Thread*, object, uintptr_t*)
|
||||||
|
Loading…
Reference in New Issue
Block a user