Merge branch 'master' of github.com:ReadyTalk/avian into concurrency_classpath_extension

This commit is contained in:
Mike Jensen 2014-01-03 08:49:40 -07:00
commit f7d77473a4
4 changed files with 65 additions and 25 deletions

View File

@ -50,12 +50,20 @@ public final class Unsafe {
public native long getLongVolatile(Object o, long offset);
public native long putLongVolatile(Object o, long offset, long x);
public native long putOrderedLong(Object o, long offset, long x);
public native void putOrderedInt(Object o, long offset, int x);
public native Object getObject(Object o, long offset);
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)
@ -765,10 +785,6 @@ Avian_sun_misc_Unsafe_getLongVolatile
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); }
object field;
if (BytesPerWord < 8) {
field = fieldForOffset(t, o, offset);
@ -788,6 +804,42 @@ Avian_sun_misc_Unsafe_getLongVolatile
return result;
}
extern "C" AVIAN_EXPORT void JNICALL
Avian_sun_misc_Unsafe_putLongVolatile
(Thread* t, object, uintptr_t* arguments)
{
object o = reinterpret_cast<object>(arguments[1]);
int64_t offset; memcpy(&offset, arguments + 2, 8);
int64_t value; memcpy(&value, arguments + 4, 8);
object field;
if (BytesPerWord < 8) {
field = fieldForOffset(t, o, offset);
PROTECT(t, field);
acquire(t, field);
} else {
storeStoreMemoryBarrier();
}
fieldAtOffset<int64_t>(o, offset) = value;
if (BytesPerWord < 8) {
release(t, field);
} else {
storeLoadMemoryBarrier();
}
}
extern "C" AVIAN_EXPORT void JNICALL
Avian_sun_misc_Unsafe_putOrderedLong
(Thread* t, object method, uintptr_t* arguments)
{
// todo: we might be able to use weaker barriers here than
// putLongVolatile does
Avian_sun_misc_Unsafe_putLongVolatile(t, method, arguments);
}
extern "C" AVIAN_EXPORT void JNICALL
Avian_sun_misc_Unsafe_unpark
(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*)

View File

@ -4007,7 +4007,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
unsigned stackSize = codeMaxStack(t, methodCode(t, context->method));
Stack stack(t);
unsigned ip = initialIp;
unsigned newIp;
unsigned newIp = -1;
stack.pushValue(Return);
start: