8065346: WB_AddToBootstrapClassLoaderSearch calls JvmtiEnv::create_a_jvmti when not in _thread_in_vm state
Summary: Removed ThreadToNativeFromVM and use java_lang_String::as_utf8_string instead
Reviewed-by: dholmes, minqi
--- a/hotspot/src/share/vm/prims/whitebox.cpp Wed Nov 19 13:02:11 2014 -0500
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Wed Nov 19 19:31:13 2014 -0800
@@ -116,24 +116,22 @@
WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
#if INCLUDE_JVMTI
- ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
- const char* seg = env->GetStringUTFChars(segment, NULL);
+ ResourceMark rm;
+ const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
assert(err == JVMTI_ERROR_NONE, "must not fail");
- env->ReleaseStringUTFChars(segment, seg);
#endif
}
WB_END
WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
#if INCLUDE_JVMTI
- ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
- const char* seg = env->GetStringUTFChars(segment, NULL);
+ ResourceMark rm;
+ const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg);
assert(err == JVMTI_ERROR_NONE, "must not fail");
- env->ReleaseStringUTFChars(segment, seg);
#endif
}
WB_END