src/share/vm/prims/whitebox.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/prims

src/share/vm/prims/whitebox.cpp

Print this page




1269                                            Monitor::_safepoint_check_never;
1270   MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
1271                    attemptedNoSafepointValue == JNI_TRUE);
1272 WB_END
1273 
1274 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
1275   oop obj_oop = JNIHandles::resolve(obj);
1276   return (jboolean) obj_oop->mark()->has_monitor();
1277 WB_END
1278 
1279 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
1280   VM_ForceSafepoint force_safepoint_op;
1281   VMThread::execute(&force_safepoint_op);
1282 WB_END
1283 
1284 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
1285   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
1286   return (jlong) ikh->constants();
1287 WB_END
1288 





1289 template <typename T>
1290 static bool GetMethodOption(JavaThread* thread, JNIEnv* env, jobject method, jstring name, T* value) {
1291   assert(value != NULL, "sanity");
1292   if (method == NULL || name == NULL) {
1293     return false;
1294   }
1295   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
1296   CHECK_JNI_EXCEPTION_(env, false);
1297   methodHandle mh(thread, Method::checked_resolve_jmethod_id(jmid));
1298   // can't be in VM when we call JNI
1299   ThreadToNativeFromVM ttnfv(thread);
1300   const char* flag_name = env->GetStringUTFChars(name, NULL);
1301   bool result =  CompilerOracle::has_option_value(mh, flag_name, *value);
1302   env->ReleaseStringUTFChars(name, flag_name);
1303   return result;
1304 }
1305 
1306 WB_ENTRY(jobject, WB_GetMethodBooleaneOption(JNIEnv* env, jobject wb, jobject method, jstring name))
1307   bool result;
1308   if (GetMethodOption<bool> (thread, env, method, name, &result)) {


1593   {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
1594   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
1595   {CC"getConstantPool0",   CC"(Ljava/lang/Class;)J",  (void*)&WB_GetConstantPool    },
1596   {CC"getMethodBooleanOption",
1597       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Boolean;",
1598                                                       (void*)&WB_GetMethodBooleaneOption},
1599   {CC"getMethodIntxOption",
1600       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1601                                                       (void*)&WB_GetMethodIntxOption},
1602   {CC"getMethodUintxOption",
1603       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1604                                                       (void*)&WB_GetMethodUintxOption},
1605   {CC"getMethodDoubleOption",
1606       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Double;",
1607                                                       (void*)&WB_GetMethodDoubleOption},
1608   {CC"getMethodStringOption",
1609       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
1610                                                       (void*)&WB_GetMethodStringOption},
1611   {CC"isShared",           CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
1612   {CC"areSharedStringsIgnored",           CC"()Z",    (void*)&WB_AreSharedStringsIgnored },

1613 };
1614 
1615 #undef CC
1616 
1617 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
1618   {
1619     if (WhiteBoxAPI) {
1620       // Make sure that wbclass is loaded by the null classloader
1621       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
1622       Handle loader(ikh->class_loader());
1623       if (loader.is_null()) {
1624         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
1625         WhiteBox::register_extended(env, wbclass, thread);
1626         WhiteBox::set_used();
1627       }
1628     }
1629   }
1630 JVM_END


1269                                            Monitor::_safepoint_check_never;
1270   MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
1271                    attemptedNoSafepointValue == JNI_TRUE);
1272 WB_END
1273 
1274 WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
1275   oop obj_oop = JNIHandles::resolve(obj);
1276   return (jboolean) obj_oop->mark()->has_monitor();
1277 WB_END
1278 
1279 WB_ENTRY(void, WB_ForceSafepoint(JNIEnv* env, jobject wb))
1280   VM_ForceSafepoint force_safepoint_op;
1281   VMThread::execute(&force_safepoint_op);
1282 WB_END
1283 
1284 WB_ENTRY(jlong, WB_GetConstantPool(JNIEnv* env, jobject wb, jclass klass))
1285   instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
1286   return (jlong) ikh->constants();
1287 WB_END
1288 
1289 WB_ENTRY(void, WB_ClearInlineCaches(JNIEnv* env, jobject wb))
1290   VM_ClearICs clear_ics;
1291   VMThread::execute(&clear_ics);
1292 WB_END
1293 
1294 template <typename T>
1295 static bool GetMethodOption(JavaThread* thread, JNIEnv* env, jobject method, jstring name, T* value) {
1296   assert(value != NULL, "sanity");
1297   if (method == NULL || name == NULL) {
1298     return false;
1299   }
1300   jmethodID jmid = reflected_method_to_jmid(thread, env, method);
1301   CHECK_JNI_EXCEPTION_(env, false);
1302   methodHandle mh(thread, Method::checked_resolve_jmethod_id(jmid));
1303   // can't be in VM when we call JNI
1304   ThreadToNativeFromVM ttnfv(thread);
1305   const char* flag_name = env->GetStringUTFChars(name, NULL);
1306   bool result =  CompilerOracle::has_option_value(mh, flag_name, *value);
1307   env->ReleaseStringUTFChars(name, flag_name);
1308   return result;
1309 }
1310 
1311 WB_ENTRY(jobject, WB_GetMethodBooleaneOption(JNIEnv* env, jobject wb, jobject method, jstring name))
1312   bool result;
1313   if (GetMethodOption<bool> (thread, env, method, name, &result)) {


1598   {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
1599   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
1600   {CC"getConstantPool0",   CC"(Ljava/lang/Class;)J",  (void*)&WB_GetConstantPool    },
1601   {CC"getMethodBooleanOption",
1602       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Boolean;",
1603                                                       (void*)&WB_GetMethodBooleaneOption},
1604   {CC"getMethodIntxOption",
1605       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1606                                                       (void*)&WB_GetMethodIntxOption},
1607   {CC"getMethodUintxOption",
1608       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1609                                                       (void*)&WB_GetMethodUintxOption},
1610   {CC"getMethodDoubleOption",
1611       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Double;",
1612                                                       (void*)&WB_GetMethodDoubleOption},
1613   {CC"getMethodStringOption",
1614       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
1615                                                       (void*)&WB_GetMethodStringOption},
1616   {CC"isShared",           CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
1617   {CC"areSharedStringsIgnored",           CC"()Z",    (void*)&WB_AreSharedStringsIgnored },
1618   {CC"clearInlineCaches",  CC"()V",                   (void*)&WB_ClearInlineCaches },
1619 };
1620 
1621 #undef CC
1622 
1623 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
1624   {
1625     if (WhiteBoxAPI) {
1626       // Make sure that wbclass is loaded by the null classloader
1627       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
1628       Handle loader(ikh->class_loader());
1629       if (loader.is_null()) {
1630         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
1631         WhiteBox::register_extended(env, wbclass, thread);
1632         WhiteBox::set_used();
1633       }
1634     }
1635   }
1636 JVM_END
src/share/vm/prims/whitebox.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File