hotspot/src/share/vm/prims/whitebox.cpp
changeset 28163 322d55d167be
parent 27923 2c79bc396381
child 28203 905c60857879
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Mon Dec 08 00:15:55 2014 -0800
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Thu Dec 11 21:34:43 2014 -0500
@@ -1078,6 +1078,14 @@
   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 @@
   {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