src/hotspot/share/aot/aotLoader.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File
*** old/src/hotspot/share/aot/aotLoader.cpp	Tue Nov 28 17:42:13 2017
--- new/src/hotspot/share/aot/aotLoader.cpp	Tue Nov 28 17:42:13 2017

*** 144,162 **** --- 144,153 ---- } FLAG_SET_DEFAULT(UseAOT, false); return; } const char* home = Arguments::get_java_home(); const char* file_separator = os::file_separator(); for (int i = 0; i < (int) (sizeof(modules) / sizeof(const char*)); i++) { char library[JVM_MAXPATHLEN]; jio_snprintf(library, sizeof(library), "%s%slib%slib%s%s%s%s", home, file_separator, file_separator, modules[i], UseCompressedOops ? "-coop" : "", UseG1GC ? "" : "-nong1", os::dll_file_extension()); load_library(library, false); } // Scan the AOTLibrary option. if (AOTLibrary != NULL) { const int len = (int)strlen(AOTLibrary); char* cp = NEW_C_HEAP_ARRAY(char, len+1, mtCode); if (cp != NULL) { // No memory?
*** 170,179 **** --- 161,180 ---- cp++; load_library(name, true); } } } + + // Load well-know AOT libraries from Java installation directory. + const char* home = Arguments::get_java_home(); + const char* file_separator = os::file_separator(); + + for (int i = 0; i < (int) (sizeof(modules) / sizeof(const char*)); i++) { + char library[JVM_MAXPATHLEN]; + jio_snprintf(library, sizeof(library), "%s%slib%slib%s%s%s%s", home, file_separator, file_separator, modules[i], UseCompressedOops ? "-coop" : "", UseG1GC ? "" : "-nong1", os::dll_file_extension()); + load_library(library, false); + } } } void AOTLoader::universe_init() { if (UseAOT && libraries_count() > 0) {
*** 237,246 **** --- 238,262 ---- } } } void AOTLoader::load_library(const char* name, bool exit_on_error) { + // Skip library if a library with the same name is already loaded. + const int file_separator = *os::file_separator(); + const char* start = strrchr(name, file_separator); + const char* new_name = (start == NULL) ? name : (start + 1); + FOR_ALL_AOT_LIBRARIES(lib) { + const char* lib_name = (*lib)->name(); + start = strrchr(lib_name, file_separator); + const char* old_name = (start == NULL) ? lib_name : (start + 1); + if (strcmp(old_name, new_name) == 0) { + if (PrintAOT) { + warning("AOT library %s is already loaded as %s.", name, lib_name); + } + return; + } + } char ebuf[1024]; void* handle = os::dll_load(name, ebuf, sizeof ebuf); if (handle == NULL) { if (exit_on_error) { tty->print_cr("error opening file: %s", ebuf);

src/hotspot/share/aot/aotLoader.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File