< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page

        

*** 1155,1168 **** #if INCLUDE_CDS // Load a class for boot loader from the shared spaces. This also // forces the super class and all interfaces to be loaded. InstanceKlass* SystemDictionary::load_shared_boot_class(Symbol* class_name, TRAPS) { InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name); if (ik != NULL && ik->is_shared_boot_class()) { ! return load_shared_class(ik, Handle(), Handle(), NULL, THREAD); } return NULL; } // Check if a shared class can be loaded by the specific classloader: --- 1155,1169 ---- #if INCLUDE_CDS // Load a class for boot loader from the shared spaces. This also // forces the super class and all interfaces to be loaded. InstanceKlass* SystemDictionary::load_shared_boot_class(Symbol* class_name, + PackageEntry* pkg_entry, TRAPS) { InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name); if (ik != NULL && ik->is_shared_boot_class()) { ! return load_shared_class(ik, Handle(), Handle(), NULL, pkg_entry, THREAD); } return NULL; } // Check if a shared class can be loaded by the specific classloader:
*** 1171,1180 **** --- 1172,1182 ---- // - Module class from "modules" jimage. ModuleEntry must be defined in the classloader. // - Class from -Xbootclasspath/a. The class has no defined PackageEntry, or must // be defined in an unnamed module. bool SystemDictionary::is_shared_class_visible(Symbol* class_name, InstanceKlass* ik, + PackageEntry* pkg_entry, Handle class_loader, TRAPS) { assert(!ModuleEntryTable::javabase_moduleEntry()->is_patched(), "Cannot use sharing if java.base is patched"); ResourceMark rm(THREAD); int path_index = ik->shared_classpath_index();
*** 1195,1210 **** "Loading non-bootstrap classes before the module system is initialized"); assert(class_loader.is_null(), "sanity"); return true; } // Get the pkg_entry from the classloader - PackageEntry* pkg_entry = NULL; ModuleEntry* mod_entry = NULL; ! TempNewSymbol pkg_name = ClassLoader::package_from_class_name(class_name); if (pkg_name != NULL) { if (loader_data != NULL) { - pkg_entry = loader_data->packages()->lookup_only(pkg_name); if (pkg_entry != NULL) { mod_entry = pkg_entry->module(); // If the archived class is from a module that has been patched at runtime, // the class cannot be loaded from the archive. if (mod_entry != NULL && mod_entry->is_patched()) { --- 1197,1211 ---- "Loading non-bootstrap classes before the module system is initialized"); assert(class_loader.is_null(), "sanity"); return true; } // Get the pkg_entry from the classloader ModuleEntry* mod_entry = NULL; ! TempNewSymbol pkg_name = pkg_entry != NULL ? pkg_entry->name() : ! ClassLoader::package_from_class_name(class_name); if (pkg_name != NULL) { if (loader_data != NULL) { if (pkg_entry != NULL) { mod_entry = pkg_entry->module(); // If the archived class is from a module that has been patched at runtime, // the class cannot be loaded from the archive. if (mod_entry != NULL && mod_entry->is_patched()) {
*** 1297,1313 **** InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik, Handle class_loader, Handle protection_domain, const ClassFileStream *cfs, TRAPS) { assert(ik != NULL, "sanity"); assert(!ik->is_unshareable_info_restored(), "shared class can be loaded only once"); Symbol* class_name = ik->name(); bool visible = is_shared_class_visible( ! class_name, ik, class_loader, CHECK_NULL); if (!visible) { return NULL; } if (!check_shared_class_super_types(ik, class_loader, protection_domain, THREAD)) { --- 1298,1315 ---- InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik, Handle class_loader, Handle protection_domain, const ClassFileStream *cfs, + PackageEntry* pkg_entry, TRAPS) { assert(ik != NULL, "sanity"); assert(!ik->is_unshareable_info_restored(), "shared class can be loaded only once"); Symbol* class_name = ik->name(); bool visible = is_shared_class_visible( ! class_name, ik, pkg_entry, class_loader, CHECK_NULL); if (!visible) { return NULL; } if (!check_shared_class_super_types(ik, class_loader, protection_domain, THREAD)) {
*** 1339,1349 **** Handle lockObject = compute_loader_lock_object(class_loader, THREAD); check_loader_lock_contention(lockObject, THREAD); ObjectLocker ol(lockObject, THREAD, true); // prohibited package check assumes all classes loaded from archive call // restore_unshareable_info which calls ik->set_package() ! ik->restore_unshareable_info(loader_data, protection_domain, CHECK_NULL); } load_shared_class_misc(ik, loader_data, CHECK_NULL); return ik; } --- 1341,1351 ---- Handle lockObject = compute_loader_lock_object(class_loader, THREAD); check_loader_lock_contention(lockObject, THREAD); ObjectLocker ol(lockObject, THREAD, true); // prohibited package check assumes all classes loaded from archive call // restore_unshareable_info which calls ik->set_package() ! ik->restore_unshareable_info(loader_data, protection_domain, pkg_entry, CHECK_NULL); } load_shared_class_misc(ik, loader_data, CHECK_NULL); return ik; }
*** 1406,1416 **** if (ik->class_loader_data() == NULL) { quick_resolve(ik, loader_data, domain, CHECK); } } ! klass->restore_unshareable_info(loader_data, domain, THREAD); load_shared_class_misc(klass, loader_data, CHECK); Dictionary* dictionary = loader_data->dictionary(); unsigned int hash = dictionary->compute_hash(klass->name()); dictionary->add_klass(hash, klass->name(), klass); add_to_hierarchy(klass, CHECK); --- 1408,1418 ---- if (ik->class_loader_data() == NULL) { quick_resolve(ik, loader_data, domain, CHECK); } } ! klass->restore_unshareable_info(loader_data, domain, NULL, THREAD); load_shared_class_misc(klass, loader_data, CHECK); Dictionary* dictionary = loader_data->dictionary(); unsigned int hash = dictionary->compute_hash(klass->name()); dictionary->add_klass(hash, klass->name(), klass); add_to_hierarchy(klass, CHECK);
*** 1486,1496 **** // Search for classes in the CDS archive. InstanceKlass* k = NULL; { #if INCLUDE_CDS PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time()); ! k = load_shared_boot_class(class_name, THREAD); #endif } if (k == NULL) { // Use VM class loader --- 1488,1498 ---- // Search for classes in the CDS archive. InstanceKlass* k = NULL; { #if INCLUDE_CDS PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time()); ! k = load_shared_boot_class(class_name, pkg_entry, THREAD); #endif } if (k == NULL) { // Use VM class loader
< prev index next >