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

src/hotspot/share/classfile/classLoader.cpp

Print this page




1454       // JFR classes
1455       ik->set_shared_classpath_index(0);
1456       ik->set_class_loader_type(ClassLoader::BOOT_LOADER);
1457     }
1458     return;
1459   }
1460 
1461   assert(has_jrt_entry(), "CDS dumping does not support exploded JDK build");
1462 
1463   ResourceMark rm(THREAD);
1464   int classpath_index = -1;
1465   PackageEntry* pkg_entry = ik->package();
1466 
1467   if (FileMapInfo::get_number_of_shared_paths() > 0) {
1468     char* canonical_path_table_entry = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
1469 
1470     // save the path from the file: protocol or the module name from the jrt: protocol
1471     // if no protocol prefix is found, path is the same as stream->source()
1472     char* path = skip_uri_protocol(src);
1473     char* canonical_class_src_path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
1474     if (!get_canonical_path(path, canonical_class_src_path, JVM_MAXPATHLEN)) {
1475       tty->print_cr("Bad pathname %s. CDS dump aborted.", path);
1476       vm_exit(1);
1477     }
1478     for (int i = 0; i < FileMapInfo::get_number_of_shared_paths(); i++) {
1479       SharedClassPathEntry* ent = FileMapInfo::shared_path(i);
1480       if (!get_canonical_path(ent->name(), canonical_path_table_entry, JVM_MAXPATHLEN)) {
1481         tty->print_cr("Bad pathname %s. CDS dump aborted.", ent->name());
1482         vm_exit(1);
1483       }
1484       // If the path (from the class stream source) is the same as the shared
1485       // class or module path, then we have a match.
1486       if (strcmp(canonical_path_table_entry, canonical_class_src_path) == 0) {
1487         // NULL pkg_entry and pkg_entry in an unnamed module implies the class
1488         // is from the -cp or boot loader append path which consists of -Xbootclasspath/a
1489         // and jvmti appended entries.
1490         if ((pkg_entry == NULL) || (pkg_entry->in_unnamed_module())) {
1491           // Ensure the index is within the -cp range before assigning
1492           // to the classpath_index.
1493           if (SystemDictionary::is_system_class_loader(loader) &&
1494               (i >= ClassLoaderExt::app_class_paths_start_index()) &&
1495               (i < ClassLoaderExt::app_module_paths_start_index())) {
1496             classpath_index = i;
1497             break;
1498           } else {
1499             if ((i >= 1) &&
1500                 (i < ClassLoaderExt::app_class_paths_start_index())) {
1501               // The class must be from boot loader append path which consists of
1502               // -Xbootclasspath/a and jvmti appended entries.
1503               assert(loader == NULL, "sanity");




1454       // JFR classes
1455       ik->set_shared_classpath_index(0);
1456       ik->set_class_loader_type(ClassLoader::BOOT_LOADER);
1457     }
1458     return;
1459   }
1460 
1461   assert(has_jrt_entry(), "CDS dumping does not support exploded JDK build");
1462 
1463   ResourceMark rm(THREAD);
1464   int classpath_index = -1;
1465   PackageEntry* pkg_entry = ik->package();
1466 
1467   if (FileMapInfo::get_number_of_shared_paths() > 0) {
1468     char* canonical_path_table_entry = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
1469 
1470     // save the path from the file: protocol or the module name from the jrt: protocol
1471     // if no protocol prefix is found, path is the same as stream->source()
1472     char* path = skip_uri_protocol(src);
1473     char* canonical_class_src_path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
1474     bool path_stat = get_canonical_path(path, canonical_class_src_path, JVM_MAXPATHLEN);
1475     assert(path_stat, "Bad src path");


1476     for (int i = 0; i < FileMapInfo::get_number_of_shared_paths(); i++) {
1477       SharedClassPathEntry* ent = FileMapInfo::shared_path(i);
1478       path_stat = get_canonical_path(ent->name(), canonical_path_table_entry, JVM_MAXPATHLEN);
1479       assert(path_stat, "Bad shared path");


1480       // If the path (from the class stream source) is the same as the shared
1481       // class or module path, then we have a match.
1482       if (strcmp(canonical_path_table_entry, canonical_class_src_path) == 0) {
1483         // NULL pkg_entry and pkg_entry in an unnamed module implies the class
1484         // is from the -cp or boot loader append path which consists of -Xbootclasspath/a
1485         // and jvmti appended entries.
1486         if ((pkg_entry == NULL) || (pkg_entry->in_unnamed_module())) {
1487           // Ensure the index is within the -cp range before assigning
1488           // to the classpath_index.
1489           if (SystemDictionary::is_system_class_loader(loader) &&
1490               (i >= ClassLoaderExt::app_class_paths_start_index()) &&
1491               (i < ClassLoaderExt::app_module_paths_start_index())) {
1492             classpath_index = i;
1493             break;
1494           } else {
1495             if ((i >= 1) &&
1496                 (i < ClassLoaderExt::app_class_paths_start_index())) {
1497               // The class must be from boot loader append path which consists of
1498               // -Xbootclasspath/a and jvmti appended entries.
1499               assert(loader == NULL, "sanity");


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