--- old/src/hotspot/share/prims/jvm.cpp 2019-10-29 10:34:19.000000000 -0700 +++ new/src/hotspot/share/prims/jvm.cpp 2019-10-29 10:34:19.000000000 -0700 @@ -742,17 +742,6 @@ // 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"); @@ -863,10 +852,9 @@ 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, + 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))); } @@ -903,7 +891,7 @@ } 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, + 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) { @@ -3469,12 +3457,9 @@ // Shared JNI/JVM entry points ////////////////////////////////////////////////////////////// -jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, jboolean link, +jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, 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 @@ -3483,11 +3468,9 @@ // 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 + // Check if we should initialize the class 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()); }