1266 WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
1267 Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
1268 Monitor::_safepoint_check_always :
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))
|
1266 WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
1267 Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
1268 Monitor::_safepoint_check_always :
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)(uintptr_t)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))
|