changeset 6924:c80ddae00f51

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
author iklam
date Wed, 19 Nov 2014 19:31:13 -0800
parents 887a7cedb892
children e194d26c9f4e
files src/share/vm/prims/whitebox.cpp
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/whitebox.cpp	Tue Nov 18 03:38:50 2014 -0800
+++ b/src/share/vm/prims/whitebox.cpp	Wed Nov 19 19:31:13 2014 -0800
@@ -129,24 +129,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