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




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





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


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

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


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


1592   {CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated  },
1593   {CC"forceSafepoint",     CC"()V",                   (void*)&WB_ForceSafepoint     },
1594   {CC"getConstantPool0",   CC"(Ljava/lang/Class;)J",  (void*)&WB_GetConstantPool    },
1595   {CC"getMethodBooleanOption",
1596       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Boolean;",
1597                                                       (void*)&WB_GetMethodBooleaneOption},
1598   {CC"getMethodIntxOption",
1599       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1600                                                       (void*)&WB_GetMethodIntxOption},
1601   {CC"getMethodUintxOption",
1602       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Long;",
1603                                                       (void*)&WB_GetMethodUintxOption},
1604   {CC"getMethodDoubleOption",
1605       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/Double;",
1606                                                       (void*)&WB_GetMethodDoubleOption},
1607   {CC"getMethodStringOption",
1608       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
1609                                                       (void*)&WB_GetMethodStringOption},
1610   {CC"isShared",           CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
1611   {CC"areSharedStringsIgnored",           CC"()Z",    (void*)&WB_AreSharedStringsIgnored },
1612   {CC"clearInlineCaches",  CC"()V",                   (void*)&WB_ClearInlineCaches },
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
src/share/vm/prims/whitebox.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File