提交 12e31f08 编写于 作者: C coleenp

8162766: Unsafe_DefineClass0 accesses raw oops while in _thread_in_native

Summary: Go to thread_in_vm to get the class_loader oop. Also reviewed by leelamohan.venati@gmail.com.
Reviewed-by: sspitsyn
上级 53e20e9b
......@@ -985,14 +985,6 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineClass(JNIEnv *env, jobject unsafe, jstring nam
}
UNSAFE_END
static jobject get_class_loader(JNIEnv* env, jclass cls) {
if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
return NULL;
}
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
oop loader = k->class_loader();
return JNIHandles::make_local(env, loader);
}
UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length))
UnsafeWrapper("Unsafe_DefineClass");
......@@ -1001,7 +993,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring na
int depthFromDefineClass0 = 1;
jclass caller = JVM_GetCallerClass(env, depthFromDefineClass0);
jobject loader = (caller == NULL) ? NULL : get_class_loader(env, caller);
jobject loader = (caller == NULL) ? NULL : JVM_GetClassLoader(env, caller);
jobject pd = (caller == NULL) ? NULL : JVM_GetProtectionDomain(env, caller);
return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册