694 695 void ClassLoader::add_to_module_path_entries(const char* path, 696 ClassPathEntry* entry) { 697 assert(entry != NULL, "ClassPathEntry should not be NULL"); 698 assert(DumpSharedSpaces, "dump time only"); 699 700 // The entry does not exist, add to the list 701 if (_module_path_entries == NULL) { 702 assert(_last_module_path_entry == NULL, "Sanity"); 703 _module_path_entries = _last_module_path_entry = entry; 704 } else { 705 _last_module_path_entry->set_next(entry); 706 _last_module_path_entry = entry; 707 } 708 } 709 710 // Add a module path to the _module_path_entries list. 711 void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) { 712 assert(DumpSharedSpaces, "dump time only"); 713 struct stat st; 714 int ret = os::stat(path, &st); 715 assert(ret == 0, "module path must exist"); 716 // File or directory found 717 ClassPathEntry* new_entry = NULL; 718 new_entry = create_class_path_entry(path, &st, true /* throw_exception */, 719 false /*is_boot_append */, CHECK); 720 if (new_entry == NULL) { 721 return; 722 } 723 724 add_to_module_path_entries(path, new_entry); 725 return; 726 } 727 728 void ClassLoader::setup_module_search_path(const char* path, TRAPS) { 729 update_module_path_entry_list(path, THREAD); 730 } 731 #endif // INCLUDE_CDS 732 733 // Construct the array of module/path pairs as specified to --patch-module 734 // for the boot loader to search ahead of the jimage, if the class being 735 // loaded is defined to a module that has been specified to --patch-module. | 694 695 void ClassLoader::add_to_module_path_entries(const char* path, 696 ClassPathEntry* entry) { 697 assert(entry != NULL, "ClassPathEntry should not be NULL"); 698 assert(DumpSharedSpaces, "dump time only"); 699 700 // The entry does not exist, add to the list 701 if (_module_path_entries == NULL) { 702 assert(_last_module_path_entry == NULL, "Sanity"); 703 _module_path_entries = _last_module_path_entry = entry; 704 } else { 705 _last_module_path_entry->set_next(entry); 706 _last_module_path_entry = entry; 707 } 708 } 709 710 // Add a module path to the _module_path_entries list. 711 void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) { 712 assert(DumpSharedSpaces, "dump time only"); 713 struct stat st; 714 if (os::stat(path, &st) != 0) { 715 tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").", 716 errno, os::errno_name(errno), path); 717 vm_exit_during_initialization(); 718 } 719 // File or directory found 720 ClassPathEntry* new_entry = NULL; 721 new_entry = create_class_path_entry(path, &st, true /* throw_exception */, 722 false /*is_boot_append */, CHECK); 723 if (new_entry == NULL) { 724 return; 725 } 726 727 add_to_module_path_entries(path, new_entry); 728 return; 729 } 730 731 void ClassLoader::setup_module_search_path(const char* path, TRAPS) { 732 update_module_path_entry_list(path, THREAD); 733 } 734 #endif // INCLUDE_CDS 735 736 // Construct the array of module/path pairs as specified to --patch-module 737 // for the boot loader to search ahead of the jimage, if the class being 738 // loaded is defined to a module that has been specified to --patch-module. |