fix bootimage regression

This commit is contained in:
Joel Dice 2016-01-16 10:19:48 -07:00
parent b5308c4866
commit ba101699a7
2 changed files with 35 additions and 4 deletions

View File

@ -2736,6 +2736,26 @@ void releaseMonitorForObject(MyThread* t, object o)
} }
} }
void acquireMonitorForClassOnEntrance(MyThread* t, GcClass* o)
{
if (LIKELY(o)) {
t->methodLockIsClean = false;
acquire(t, getJClass(t, o));
t->methodLockIsClean = true;
} else {
throwNew(t, GcNullPointerException::Type);
}
}
void releaseMonitorForClass(MyThread* t, GcClass* o)
{
if (LIKELY(o)) {
release(t, getJClass(t, o));
} else {
throwNew(t, GcNullPointerException::Type);
}
}
object makeMultidimensionalArray2(MyThread* t, object makeMultidimensionalArray2(MyThread* t,
GcClass* class_, GcClass* class_,
uintptr_t* countStack, uintptr_t* countStack,
@ -3377,7 +3397,7 @@ void handleMonitorEvent(MyThread* t, Frame* frame, intptr_t function)
if (method->flags() & ACC_STATIC) { if (method->flags() & ACC_STATIC) {
PROTECT(t, method); PROTECT(t, method);
lock = frame->append(getJClass(t, method->class_())); lock = frame->append(method->class_());
} else { } else {
lock = loadLocal( lock = loadLocal(
frame->context, 1, ir::Type::object(), savedTargetIndex(t, method)); frame->context, 1, ir::Type::object(), savedTargetIndex(t, method));
@ -3406,13 +3426,22 @@ void handleEntrance(MyThread* t, Frame* frame)
frame->set(index, ir::Type::object()); frame->set(index, ir::Type::object());
} }
handleMonitorEvent( handleMonitorEvent(t,
t, frame, getThunk(t, acquireMonitorForObjectOnEntranceThunk)); frame,
getThunk(t,
method->flags() & ACC_STATIC
? acquireMonitorForClassOnEntranceThunk
: acquireMonitorForObjectOnEntranceThunk));
} }
void handleExit(MyThread* t, Frame* frame) void handleExit(MyThread* t, Frame* frame)
{ {
handleMonitorEvent(t, frame, getThunk(t, releaseMonitorForObjectThunk)); handleMonitorEvent(t,
frame,
getThunk(t,
frame->context->method->flags() & ACC_STATIC
? releaseMonitorForClassThunk
: releaseMonitorForObjectThunk));
} }
bool inTryBlock(MyThread* t UNUSED, GcCode* code, unsigned ip) bool inTryBlock(MyThread* t UNUSED, GcCode* code, unsigned ip)

View File

@ -48,6 +48,8 @@ THUNK(setMaybeNull)
THUNK(acquireMonitorForObject) THUNK(acquireMonitorForObject)
THUNK(acquireMonitorForObjectOnEntrance) THUNK(acquireMonitorForObjectOnEntrance)
THUNK(releaseMonitorForObject) THUNK(releaseMonitorForObject)
THUNK(acquireMonitorForClassOnEntrance)
THUNK(releaseMonitorForClass)
THUNK(makeMultidimensionalArray) THUNK(makeMultidimensionalArray)
THUNK(makeMultidimensionalArrayFromReference) THUNK(makeMultidimensionalArrayFromReference)
THUNK(throw_) THUNK(throw_)