8068272: Extend WhiteBox API with methods that check monitor state and force safepoint
authorfzhinkin
Tue, 30 Dec 2014 11:07:49 +0300
changeset 28393 18701d7781e7
parent 28392 f64a0abbff20
child 28394 6d382dc493e5
8068272: Extend WhiteBox API with methods that check monitor state and force safepoint Reviewed-by: kvn, iignatyev
hotspot/src/share/vm/prims/whitebox.cpp
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Thu Dec 25 15:57:38 2014 +0300
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Tue Dec 30 11:07:49 2014 +0300
@@ -1123,6 +1123,16 @@
                    attemptedNoSafepointValue == JNI_TRUE);
 WB_END
 
+WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
+  oop obj_oop = JNIHandles::resolve(obj);
+  return (jboolean) obj_oop->mark()->has_monitor();
+WB_END
+
+WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
+  VM_ForceSafepoint force_safepoint_op;
+  VMThread::execute(&force_safepoint_op);
+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) {
@@ -1321,6 +1331,8 @@
   {CC"getThreadStackSize", CC"()J",                   (void*)&WB_GetThreadStackSize },
   {CC"getThreadRemainingStackSize", CC"()J",          (void*)&WB_GetThreadRemainingStackSize },
   {CC"assertMatchingSafepointCalls", CC"(ZZ)V",       (void*)&WB_AssertMatchingSafepointCalls },
+  {CC"isMonitorInflated",  CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
+  {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
 };
 
 #undef CC