src/hotspot/share/classfile/classLoader.cpp
changeset 58447 319173c62caa
parent 58110 85e1de070bef
child 58545 725244418646
equal deleted inserted replaced
58446:5c83830390ba 58447:319173c62caa
   460   return true;
   460   return true;
   461 }
   461 }
   462 
   462 
   463 #if INCLUDE_CDS
   463 #if INCLUDE_CDS
   464 void ClassLoader::exit_with_path_failure(const char* error, const char* message) {
   464 void ClassLoader::exit_with_path_failure(const char* error, const char* message) {
   465   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "only called at dump time");
   465   Arguments::assert_is_dumping_archive();
   466   tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure");
   466   tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure");
   467   vm_exit_during_initialization(error, message);
   467   vm_exit_during_initialization(error, message);
   468 }
   468 }
   469 #endif
   469 #endif
   470 
   470 
   530   setup_boot_search_path(sys_class_path);
   530   setup_boot_search_path(sys_class_path);
   531 }
   531 }
   532 
   532 
   533 #if INCLUDE_CDS
   533 #if INCLUDE_CDS
   534 void ClassLoader::setup_app_search_path(const char *class_path) {
   534 void ClassLoader::setup_app_search_path(const char *class_path) {
   535   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Sanity");
   535   Arguments::assert_is_dumping_archive();
   536 
   536 
   537   ResourceMark rm;
   537   ResourceMark rm;
   538   ClasspathStream cp_stream(class_path);
   538   ClasspathStream cp_stream(class_path);
   539 
   539 
   540   while (cp_stream.has_next()) {
   540   while (cp_stream.has_next()) {
   544 }
   544 }
   545 
   545 
   546 void ClassLoader::add_to_module_path_entries(const char* path,
   546 void ClassLoader::add_to_module_path_entries(const char* path,
   547                                              ClassPathEntry* entry) {
   547                                              ClassPathEntry* entry) {
   548   assert(entry != NULL, "ClassPathEntry should not be NULL");
   548   assert(entry != NULL, "ClassPathEntry should not be NULL");
   549   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only");
   549   Arguments::assert_is_dumping_archive();
   550 
   550 
   551   // The entry does not exist, add to the list
   551   // The entry does not exist, add to the list
   552   if (_module_path_entries == NULL) {
   552   if (_module_path_entries == NULL) {
   553     assert(_last_module_path_entry == NULL, "Sanity");
   553     assert(_last_module_path_entry == NULL, "Sanity");
   554     _module_path_entries = _last_module_path_entry = entry;
   554     _module_path_entries = _last_module_path_entry = entry;
   558   }
   558   }
   559 }
   559 }
   560 
   560 
   561 // Add a module path to the _module_path_entries list.
   561 // Add a module path to the _module_path_entries list.
   562 void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) {
   562 void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) {
   563   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only");
   563   Arguments::assert_is_dumping_archive();
   564   struct stat st;
   564   struct stat st;
   565   if (os::stat(path, &st) != 0) {
   565   if (os::stat(path, &st) != 0) {
   566     tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").",
   566     tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").",
   567       errno, os::errno_name(errno), path);
   567       errno, os::errno_name(errno), path);
   568     vm_exit_during_initialization();
   568     vm_exit_during_initialization();
   654   ResourceMark rm(THREAD);
   654   ResourceMark rm(THREAD);
   655   ClasspathStream cp_stream(class_path);
   655   ClasspathStream cp_stream(class_path);
   656   bool set_base_piece = true;
   656   bool set_base_piece = true;
   657 
   657 
   658 #if INCLUDE_CDS
   658 #if INCLUDE_CDS
   659   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
   659   if (Arguments::is_dumping_archive()) {
   660     if (!Arguments::has_jimage()) {
   660     if (!Arguments::has_jimage()) {
   661       vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
   661       vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
   662     }
   662     }
   663   }
   663   }
   664 #endif
   664 #endif
  1358 }
  1358 }
  1359 
  1359 
  1360 // Record the shared classpath index and loader type for classes loaded
  1360 // Record the shared classpath index and loader type for classes loaded
  1361 // by the builtin loaders at dump time.
  1361 // by the builtin loaders at dump time.
  1362 void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS) {
  1362 void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS) {
  1363   assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "sanity");
  1363   Arguments::assert_is_dumping_archive();
  1364   assert(stream != NULL, "sanity");
  1364   assert(stream != NULL, "sanity");
  1365 
  1365 
  1366   if (ik->is_unsafe_anonymous()) {
  1366   if (ik->is_unsafe_anonymous()) {
  1367     // We do not archive unsafe anonymous classes.
  1367     // We do not archive unsafe anonymous classes.
  1368     return;
  1368     return;
  1535   setup_bootstrap_search_path();
  1535   setup_bootstrap_search_path();
  1536 }
  1536 }
  1537 
  1537 
  1538 #if INCLUDE_CDS
  1538 #if INCLUDE_CDS
  1539 void ClassLoader::initialize_shared_path() {
  1539 void ClassLoader::initialize_shared_path() {
  1540   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
  1540   if (Arguments::is_dumping_archive()) {
  1541     ClassLoaderExt::setup_search_paths();
  1541     ClassLoaderExt::setup_search_paths();
  1542   }
  1542   }
  1543 }
  1543 }
  1544 
  1544 
  1545 void ClassLoader::initialize_module_path(TRAPS) {
  1545 void ClassLoader::initialize_module_path(TRAPS) {
  1546   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
  1546   if (Arguments::is_dumping_archive()) {
  1547     ClassLoaderExt::setup_module_paths(THREAD);
  1547     ClassLoaderExt::setup_module_paths(THREAD);
  1548     FileMapInfo::allocate_shared_path_table();
  1548     FileMapInfo::allocate_shared_path_table();
  1549   }
  1549   }
  1550 }
  1550 }
  1551 #endif
  1551 #endif