src/hotspot/share/classfile/classLoader.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff src/hotspot/share/classfile/classLoader.cpp
src/hotspot/share/classfile/classLoader.cpp
Print this page
*** 721,736 ****
end++;
}
}
}
void ClassLoader::setup_module_search_path(const char* path) {
check_shared_classpath(path);
update_module_path_entry_list(path);
}
!
! #endif
// Construct the array of module/path pairs as specified to --patch-module
// for the boot loader to search ahead of the jimage, if the class being
// loaded is defined to a module that has been specified to --patch-module.
void ClassLoader::setup_patch_mod_entries() {
--- 721,770 ----
end++;
}
}
}
+ void ClassLoader::add_to_module_path_entries(const char* path,
+ ClassPathEntry* entry) {
+ assert(entry != NULL, "ClassPathEntry should not be NULL");
+ assert(DumpSharedSpaces, "dump time only");
+
+ // The entry does not exist, add to the list
+ if (_module_path_entries == NULL) {
+ assert(_last_module_path_entry == NULL, "Sanity");
+ _module_path_entries = _last_module_path_entry = entry;
+ } else {
+ _last_module_path_entry->set_next(entry);
+ _last_module_path_entry = entry;
+ }
+ }
+
+ // Add a module path to the _module_path_entries list.
+ void ClassLoader::update_module_path_entry_list(const char *path,
+ bool throw_exception) {
+ assert(DumpSharedSpaces, "dump time only");
+ struct stat st;
+ int ret = os::stat(path, &st);
+ assert(ret == 0, "module path must exist");
+ // File or directory found
+ ClassPathEntry* new_entry = NULL;
+ Thread* THREAD = Thread::current();
+ new_entry = create_class_path_entry(path, &st, throw_exception,
+ false /*is_boot_append */, CHECK);
+ if (new_entry == NULL) {
+ return;
+ }
+
+ add_to_module_path_entries(path, new_entry);
+ return;
+ }
+
void ClassLoader::setup_module_search_path(const char* path) {
check_shared_classpath(path);
update_module_path_entry_list(path);
}
! #endif // INCLUDE_CDS
// Construct the array of module/path pairs as specified to --patch-module
// for the boot loader to search ahead of the jimage, if the class being
// loaded is defined to a module that has been specified to --patch-module.
void ClassLoader::setup_patch_mod_entries() {
*** 1093,1137 ****
#endif
return false;
}
}
- #if INCLUDE_CDS
- void ClassLoader::add_to_module_path_entries(const char* path,
- ClassPathEntry* entry) {
- assert(entry != NULL, "ClassPathEntry should not be NULL");
- ClassPathEntry* e = _module_path_entries;
-
- // The entry does not exist, add to the list
- if (_module_path_entries == NULL) {
- assert(_last_module_path_entry == NULL, "Sanity");
- _module_path_entries = _last_module_path_entry = entry;
- } else {
- _last_module_path_entry->set_next(entry);
- _last_module_path_entry = entry;
- }
- }
-
- // Add a module path to the _module_path_entries list.
- void ClassLoader::update_module_path_entry_list(const char *path,
- bool throw_exception) {
- struct stat st;
- assert(os::stat(path, &st) == 0, "module path must exist");
- // File or directory found
- ClassPathEntry* new_entry = NULL;
- Thread* THREAD = Thread::current();
- new_entry = create_class_path_entry(path, &st, throw_exception,
- false /*is_boot_append */, CHECK);
- if (new_entry == NULL) {
- return;
- }
-
- add_to_module_path_entries(path, new_entry);
- return;
- }
- #endif // INCLUDE_CDS
-
static void print_module_entry_table(const GrowableArray<ModuleClassPathList*>* const module_list) {
ResourceMark rm;
int num_of_entries = module_list->length();
for (int i = 0; i < num_of_entries; i++) {
ClassPathEntry* e;
--- 1127,1136 ----
*** 1613,1641 ****
if (get_canonical_path(ent->name(), canonical_path, JVM_MAXPATHLEN)) {
// If the path (from the class stream source) is the same as the shared
// class or module path, then we have a match.
if (strcmp(canonical_path, os::native_path((char*)path)) == 0) {
// NULL pkg_entry and pkg_entry in an unnamed module implies the class
! // is from the -cp. Ensure the index is within the -cp range before assigning
! // to the classpath_index.
if ((pkg_entry == NULL) || (pkg_entry->in_unnamed_module())) {
if (SystemDictionary::is_system_class_loader(loader) &&
(i >= ClassLoaderExt::app_class_paths_start_index()) &&
(i < ClassLoaderExt::app_module_paths_start_index())) {
classpath_index = i;
break;
} else {
if ((i >= 1) &&
(i < ClassLoaderExt::app_module_paths_start_index())) {
classpath_index = i;
break;
}
}
} else {
! // non-NULL pkg_entry and is a named module implies the class is from the
! // --module-path. Ensure the index is within the --module-path range before
! // assigning to the classpath_index.
if ((pkg_entry != NULL) && !(pkg_entry->in_unnamed_module()) && (i > 0)) {
if (i >= ClassLoaderExt::app_module_paths_start_index() &&
i < FileMapInfo::get_number_of_shared_paths()) {
classpath_index = i;
break;
--- 1612,1642 ----
if (get_canonical_path(ent->name(), canonical_path, JVM_MAXPATHLEN)) {
// If the path (from the class stream source) is the same as the shared
// class or module path, then we have a match.
if (strcmp(canonical_path, os::native_path((char*)path)) == 0) {
// NULL pkg_entry and pkg_entry in an unnamed module implies the class
! // is from the -cp or -Xbootclasspath/a.
if ((pkg_entry == NULL) || (pkg_entry->in_unnamed_module())) {
+ // Ensure the index is within the -cp range before assigning
+ // to the classpath_index.
if (SystemDictionary::is_system_class_loader(loader) &&
(i >= ClassLoaderExt::app_class_paths_start_index()) &&
(i < ClassLoaderExt::app_module_paths_start_index())) {
classpath_index = i;
break;
} else {
if ((i >= 1) &&
(i < ClassLoaderExt::app_module_paths_start_index())) {
+ // The class must be from -Xbootclasspath/a
+ assert(loader == NULL, "sanity");
classpath_index = i;
break;
}
}
} else {
! // A class from a named module from the --module-path. Ensure the index is
! // within the --module-path range before assigning to the classpath_index.
if ((pkg_entry != NULL) && !(pkg_entry->in_unnamed_module()) && (i > 0)) {
if (i >= ClassLoaderExt::app_module_paths_start_index() &&
i < FileMapInfo::get_number_of_shared_paths()) {
classpath_index = i;
break;
*** 1657,1666 ****
--- 1658,1670 ----
if (classpath_index < 0) {
assert(ik->shared_classpath_index() < 0, "Sanity");
return;
}
} else {
+ // The shared path table is set up after module system initialization.
+ // The path table contains no entry before that. Any classes loaded prior
+ // to the setup of the shared path table must be from the modules image.
assert(is_modules_image(src), "stream must be from modules image");
assert(FileMapInfo::get_number_of_shared_paths() == 0, "shared path table must not have been setup");
classpath_index = 0;
}
src/hotspot/share/classfile/classLoader.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File