src/hotspot/share/classfile/classLoaderExt.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Cdiff src/hotspot/share/classfile/classLoaderExt.cpp

src/hotspot/share/classfile/classLoaderExt.cpp

Print this page
rev 49528 : [mq]: module_path

*** 28,37 **** --- 28,38 ---- #include "classfile/classListParser.hpp" #include "classfile/classLoader.inline.hpp" #include "classfile/classLoaderExt.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/klassFactory.hpp" + #include "classfile/modules.hpp" #include "classfile/sharedClassUtil.hpp" #include "classfile/sharedPathsMiscInfo.hpp" #include "classfile/systemDictionaryShared.hpp" #include "classfile/vmSymbols.hpp" #include "memory/allocation.inline.hpp"
*** 39,61 **** #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "runtime/arguments.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" #include "runtime/os.hpp" #include "services/threadService.hpp" #include "utilities/stringUtils.hpp" ! jshort ClassLoaderExt::_app_paths_start_index = ClassLoaderExt::max_classpath_index; bool ClassLoaderExt::_has_app_classes = false; bool ClassLoaderExt::_has_platform_classes = false; void ClassLoaderExt::setup_app_search_path() { assert(DumpSharedSpaces, "this function is only used with -Xshare:dump and -XX:+UseAppCDS"); ! _app_paths_start_index = ClassLoader::num_boot_classpath_entries(); char* app_class_path = os::strdup(Arguments::get_appclasspath()); if (strcmp(app_class_path, ".") == 0) { // This doesn't make any sense, even for AppCDS, so let's skip it. We // don't want to throw an error here because -cp "." is usually assigned --- 40,64 ---- #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "runtime/arguments.hpp" + #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" #include "runtime/os.hpp" #include "services/threadService.hpp" #include "utilities/stringUtils.hpp" ! jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index; ! jshort ClassLoaderExt::_app_module_paths_start_index = ClassLoaderExt::max_classpath_index; bool ClassLoaderExt::_has_app_classes = false; bool ClassLoaderExt::_has_platform_classes = false; void ClassLoaderExt::setup_app_search_path() { assert(DumpSharedSpaces, "this function is only used with -Xshare:dump and -XX:+UseAppCDS"); ! _app_class_paths_start_index = ClassLoader::num_boot_classpath_entries(); char* app_class_path = os::strdup(Arguments::get_appclasspath()); if (strcmp(app_class_path, ".") == 0) { // This doesn't make any sense, even for AppCDS, so let's skip it. We // don't want to throw an error here because -cp "." is usually assigned
*** 66,75 **** --- 69,102 ---- shared_paths_misc_info()->add_app_classpath(app_class_path); ClassLoader::setup_app_search_path(app_class_path); } } + void ClassLoaderExt::process_module_table(ModuleEntryTable* met) { + ResourceMark rm; + for (int i = 0; i < met->table_size(); i++) { + for (ModuleEntry* m = met->bucket(i); m != NULL;) { + char* path = m->location()->as_C_string(); + if (strncmp(path, "file:", 5) == 0 && ClassLoader::string_ends_with(path, ".jar")) { + m->print(); + path = ClassLoader::skip_uri_protocol(path); + ClassLoader::setup_module_search_path(path); + } + m = m->next(); + } + } + } + void ClassLoaderExt::setup_module_search_path() { + assert(DumpSharedSpaces, "this function is only used with -Xshare:dump and -XX:+UseAppCDS"); + _app_module_paths_start_index = ClassLoader::num_boot_classpath_entries() + + ClassLoader::num_app_classpath_entries(); + Thread* thread = Thread::current(); + Handle system_class_loader (thread, SystemDictionary::java_system_loader()); + ModuleEntryTable* met = Modules::get_module_entry_table(system_class_loader); + process_module_table(met); + } + char* ClassLoaderExt::read_manifest(ClassPathEntry* entry, jint *manifest_size, bool clean_text, TRAPS) { const char* name = "META-INF/MANIFEST.MF"; char* manifest; jint size;
*** 193,202 **** --- 220,235 ---- shared_paths_misc_info()->record_app_offset(); ClassLoaderExt::setup_app_search_path(); } } + void ClassLoaderExt::setup_module_paths() { + if (UseAppCDS) { + ClassLoaderExt::setup_module_search_path(); + } + } + Thread* ClassLoaderExt::Context::_dump_thread = NULL; void ClassLoaderExt::record_result(ClassLoaderExt::Context *context, Symbol* class_name, const s2 classpath_index,
src/hotspot/share/classfile/classLoaderExt.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File