mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
8324584: Optimize Symbol and char* handling in ClassLoader
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
a0e5e16afb
commit
9a1b843ff6
3 changed files with 11 additions and 14 deletions
|
@ -1030,17 +1030,14 @@ static ClassPathEntry* find_first_module_cpe(ModuleEntry* mod_entry,
|
|||
}
|
||||
|
||||
|
||||
// Search either the patch-module or exploded build entries for class.
|
||||
// Search the module list for the class file stream based on the file name and java package
|
||||
ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
|
||||
const GrowableArray<ModuleClassPathList*>* const module_list,
|
||||
const char* const class_name,
|
||||
PackageEntry* pkg_entry, // Java package entry derived from the class name
|
||||
const char* const file_name) {
|
||||
ClassFileStream* stream = nullptr;
|
||||
|
||||
// Find the class' defining module in the boot loader's module entry table
|
||||
TempNewSymbol class_name_symbol = SymbolTable::new_symbol(class_name);
|
||||
TempNewSymbol pkg_name = package_from_class_name(class_name_symbol);
|
||||
PackageEntry* pkg_entry = get_package_entry(pkg_name, ClassLoaderData::the_null_class_loader_data());
|
||||
// Find the defining module in the boot loader's module entry table
|
||||
ModuleEntry* mod_entry = (pkg_entry != nullptr) ? pkg_entry->module() : nullptr;
|
||||
|
||||
// If the module system has not defined java.base yet, then
|
||||
|
@ -1085,7 +1082,7 @@ ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
|
|||
}
|
||||
|
||||
// Called by the boot classloader to load classes
|
||||
InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) {
|
||||
InstanceKlass* ClassLoader::load_class(Symbol* name, PackageEntry* pkg_entry, bool search_append_only, TRAPS) {
|
||||
assert(name != nullptr, "invariant");
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
@ -1132,7 +1129,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
|
|||
// is not supported with UseSharedSpaces, we can never come here during dynamic dumping.
|
||||
assert(!CDSConfig::is_dumping_dynamic_archive(), "sanity");
|
||||
if (!CDSConfig::is_dumping_static_archive()) {
|
||||
stream = search_module_entries(THREAD, _patch_mod_entries, class_name, file_name);
|
||||
stream = search_module_entries(THREAD, _patch_mod_entries, pkg_entry, file_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1144,7 +1141,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
|
|||
} else {
|
||||
// Exploded build - attempt to locate class in its defining module's location.
|
||||
assert(_exploded_entries != nullptr, "No exploded build entries present");
|
||||
stream = search_module_entries(THREAD, _exploded_entries, class_name, file_name);
|
||||
stream = search_module_entries(THREAD, _exploded_entries, pkg_entry, file_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue