< prev index next >
src/hotspot/share/prims/jvm.cpp
Print this page
*** 740,760 ****
// Misc. class handling ///////////////////////////////////////////////////////////
- JVM_ENTRY(void, JVM_LinkClass(JNIEnv* env, jclass classClass, jclass arg))
- JVMWrapper("JVM_LinkClass");
-
- oop r = JNIHandles::resolve(arg);
- Klass* klass = java_lang_Class::as_Klass(r);
-
- if (!ClassForNameDeferLinking && klass->is_instance_klass()) {
- InstanceKlass::cast(klass)->link_class(CHECK);
- }
- JVM_END
-
JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
JVMWrapper("JVM_GetCallerClass");
// Getting the class of the caller frame.
//
--- 740,749 ----
*** 861,874 ****
protection_domain = java_lang_Class::as_Klass(from_class)->protection_domain();
}
Handle h_loader(THREAD, loader_oop);
Handle h_prot(THREAD, protection_domain);
!
! jboolean link = !ClassForNameDeferLinking;
! jclass result = find_class_from_class_loader(env, h_name, init, link, h_loader,
h_prot, false, THREAD);
if (log_is_enabled(Debug, class, resolve) && result != NULL) {
trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
}
return result;
JVM_END
--- 850,862 ----
protection_domain = java_lang_Class::as_Klass(from_class)->protection_domain();
}
Handle h_loader(THREAD, loader_oop);
Handle h_prot(THREAD, protection_domain);
! jclass result = find_class_from_class_loader(env, h_name, init, h_loader,
h_prot, false, THREAD);
+
if (log_is_enabled(Debug, class, resolve) && result != NULL) {
trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
}
return result;
JVM_END
*** 901,911 ****
class_loader = from_class->class_loader();
protection_domain = from_class->protection_domain();
}
Handle h_loader(THREAD, class_loader);
Handle h_prot (THREAD, protection_domain);
! jclass result = find_class_from_class_loader(env, h_name, init, false, h_loader,
h_prot, true, thread);
if (log_is_enabled(Debug, class, resolve) && result != NULL) {
// this function is generally only used for class loading during verification.
ResourceMark rm;
--- 889,899 ----
class_loader = from_class->class_loader();
protection_domain = from_class->protection_domain();
}
Handle h_loader(THREAD, class_loader);
Handle h_prot (THREAD, protection_domain);
! jclass result = find_class_from_class_loader(env, h_name, init, h_loader,
h_prot, true, thread);
if (log_is_enabled(Debug, class, resolve) && result != NULL) {
// this function is generally only used for class loading during verification.
ResourceMark rm;
*** 3467,3495 ****
}
// Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
! jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, jboolean link,
Handle loader, Handle protection_domain,
jboolean throwError, TRAPS) {
- // Initialization also implies linking - check for coherent args
- assert((init && link) || !init, "incorrect use of init/link arguments");
-
// Security Note:
// The Java level wrapper will perform the necessary security check allowing
// us to pass the NULL as the initiating class loader. The VM is responsible for
// the checkPackageAccess relative to the initiating class loader via the
// protection_domain. The protection_domain is passed as NULL by the java code
// if there is no security manager in 3-arg Class.forName().
Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
! // Check if we should initialize the class (which implies linking), or just link it
if (init && klass->is_instance_klass()) {
klass->initialize(CHECK_NULL);
- } else if (link && klass->is_instance_klass()) {
- InstanceKlass::cast(klass)->link_class(CHECK_NULL);
}
return (jclass) JNIHandles::make_local(env, klass->java_mirror());
}
--- 3455,3478 ----
}
// Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
! jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init,
Handle loader, Handle protection_domain,
jboolean throwError, TRAPS) {
// Security Note:
// The Java level wrapper will perform the necessary security check allowing
// us to pass the NULL as the initiating class loader. The VM is responsible for
// the checkPackageAccess relative to the initiating class loader via the
// protection_domain. The protection_domain is passed as NULL by the java code
// if there is no security manager in 3-arg Class.forName().
Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
! // Check if we should initialize the class
if (init && klass->is_instance_klass()) {
klass->initialize(CHECK_NULL);
}
return (jclass) JNIHandles::make_local(env, klass->java_mirror());
}
< prev index next >