--- old/src/hotspot/share/classfile/systemDictionaryShared.cpp 2020-04-27 19:03:00.094129079 +0000 +++ new/src/hotspot/share/classfile/systemDictionaryShared.cpp 2020-04-27 19:02:58.904099435 +0000 @@ -479,37 +479,6 @@ } } -// Define Package for shared app/platform classes from named module -void SystemDictionaryShared::define_shared_package(Symbol* class_name, - Handle class_loader, - ModuleEntry* mod_entry, - TRAPS) { - assert(mod_entry != NULL, "module_entry should not be NULL"); - Handle module_handle(THREAD, mod_entry->module()); - - Handle pkg_name = get_package_name(class_name, CHECK); - assert(pkg_name.not_null(), "Package should not be null for class in named module"); - - Klass* classLoader_klass; - if (SystemDictionary::is_system_class_loader(class_loader())) { - classLoader_klass = SystemDictionary::jdk_internal_loader_ClassLoaders_AppClassLoader_klass(); - } else { - assert(SystemDictionary::is_platform_class_loader(class_loader()), "unexpected classloader"); - classLoader_klass = SystemDictionary::jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass(); - } - - JavaValue result(T_OBJECT); - JavaCallArguments args(2); - args.set_receiver(class_loader); - args.push_oop(pkg_name); - args.push_oop(module_handle); - JavaCalls::call_virtual(&result, classLoader_klass, - vmSymbols::definePackage_name(), - vmSymbols::definePackage_signature(), - &args, - CHECK); -} - // Get the ProtectionDomain associated with the CodeSource from the classloader. Handle SystemDictionaryShared::get_protection_domain_from_classloader(Handle class_loader, Handle url, TRAPS) { @@ -598,11 +567,11 @@ // For shared app/platform classes originated from the run-time image: // The ProtectionDomains are cached in the corresponding ModuleEntries // for fast access by the VM. - if (pkg_entry != NULL) { - ModuleEntry* mod_entry = pkg_entry->module(); - pd = get_shared_protection_domain(class_loader, mod_entry, THREAD); - define_shared_package(class_name, class_loader, mod_entry, CHECK_(pd)); - } + // all packages from module image are already created during VM bootstrap in + // Modules::define_module(). + assert(pkg_entry != NULL, "archived class in module image cannot be from unnamed package"); + ModuleEntry* mod_entry = pkg_entry->module(); + pd = get_shared_protection_domain(class_loader, mod_entry, THREAD); } else { // For shared app/platform classes originated from JAR files on the class path: // Each of the 3 SystemDictionaryShared::_shared_xxx arrays has the same length --- old/src/hotspot/share/classfile/systemDictionaryShared.hpp 2020-04-27 19:03:03.283208520 +0000 +++ new/src/hotspot/share/classfile/systemDictionaryShared.hpp 2020-04-27 19:03:02.090178801 +0000 @@ -167,10 +167,6 @@ Handle manifest, Handle url, TRAPS); - static void define_shared_package(Symbol* class_name, - Handle class_loader, - ModuleEntry* mod_entry, - TRAPS); static Handle get_shared_jar_manifest(int shared_path_index, TRAPS); static Handle get_shared_jar_url(int shared_path_index, TRAPS); --- old/src/hotspot/share/classfile/vmSymbols.hpp 2020-04-27 19:03:06.695293517 +0000 +++ new/src/hotspot/share/classfile/vmSymbols.hpp 2020-04-27 19:03:05.506263897 +0000 @@ -436,8 +436,6 @@ template(input_stream_signature, "Ljava/io/InputStream;") \ template(print_stream_signature, "Ljava/io/PrintStream;") \ template(security_manager_signature, "Ljava/lang/SecurityManager;") \ - template(definePackage_name, "definePackage") \ - template(definePackage_signature, "(Ljava/lang/String;Ljava/lang/Module;)Ljava/lang/Package;") \ template(defineOrCheckPackage_name, "defineOrCheckPackage") \ template(defineOrCheckPackage_signature, "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)Ljava/lang/Package;") \ template(fileToEncodedURL_name, "fileToEncodedURL") \ --- old/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java 2020-04-27 19:03:09.914373705 +0000 +++ new/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java 2020-04-27 19:03:08.728344161 +0000 @@ -132,16 +132,6 @@ PlatformClassLoader(BootClassLoader parent) { super("platform", parent, null); } - - /** - * Called by the VM to support define package for AppCDS. - * - * Shared classes are returned in ClassLoader::findLoadedClass - * that bypass the defineClass call. - */ - private Package definePackage(String pn, Module module) { - return JLA.definePackage(this, pn, module); - } } /** @@ -195,16 +185,6 @@ } /** - * Called by the VM to support define package for AppCDS - * - * Shared classes are returned in ClassLoader::findLoadedClass - * that bypass the defineClass call. - */ - private Package definePackage(String pn, Module module) { - return JLA.definePackage(this, pn, module); - } - - /** * Called by the VM to support define package for AppCDS */ protected Package defineOrCheckPackage(String pn, Manifest man, URL url) {