8047290: Make Mutex::_no_safepoint_check_flag locks verify that this lock never checks for safepoint

Ensure consistent safepoint checking in Mutex/Monitor locking methods.

Reviewed-by: dholmes, dcubed, coleenp
This commit is contained in:
Max Ockner 2014-12-11 21:34:43 -05:00 committed by Coleen Phillimore
parent bb30bd7e0a
commit 1d76295d70
32 changed files with 447 additions and 134 deletions

View file

@ -1078,6 +1078,14 @@ WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
return (jlong) MetaspaceGC::capacity_until_GC();
WB_END
WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
Monitor::_safepoint_check_always :
Monitor::_safepoint_check_never;
MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
attemptedNoSafepointValue == JNI_TRUE);
WB_END
//Some convenience methods to deal with objects from java
int WhiteBox::offset_for_field(const char* field_name, oop object,
Symbol* signature_symbol) {
@ -1274,6 +1282,7 @@ static JNINativeMethod methods[] = {
{CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
{CC"assertMatchingSafepointCalls", CC"(ZZ)V", (void*)&WB_AssertMatchingSafepointCalls },
};
#undef CC