< prev index next >

src/share/vm/classfile/classLoader.cpp

Print this page

        

*** 138,148 **** PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL; PerfCounter* ClassLoader::_isUnsyncloadClass = NULL; PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL; ! GrowableArray<ModuleClassPathList*>* ClassLoader::_xpatch_entries = NULL; ClassPathEntry* ClassLoader::_first_entry = NULL; ClassPathEntry* ClassLoader::_last_entry = NULL; int ClassLoader::_num_entries = 0; ClassPathEntry* ClassLoader::_first_append_entry = NULL; bool ClassLoader::_has_jimage = false; --- 138,148 ---- PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL; PerfCounter* ClassLoader::_isUnsyncloadClass = NULL; PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL; ! GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL; ClassPathEntry* ClassLoader::_first_entry = NULL; ClassPathEntry* ClassLoader::_last_entry = NULL; int ClassLoader::_num_entries = 0; ClassPathEntry* ClassLoader::_first_append_entry = NULL; bool ClassLoader::_has_jimage = false;
*** 684,711 **** delete checker; return result; } #endif ! // Construct the array of module/path pairs as specified to -Xpatch // 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 -Xpatch. ! void ClassLoader::setup_xpatch_entries() { Thread* THREAD = Thread::current(); ! GrowableArray<ModuleXPatchPath*>* xpatch_args = Arguments::get_xpatchprefix(); ! int num_of_entries = xpatch_args->length(); ! // Set up the boot loader's xpatch_entries list ! _xpatch_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true); for (int i = 0; i < num_of_entries; i++) { ! const char* module_name = (xpatch_args->at(i))->module_name(); Symbol* const module_sym = SymbolTable::lookup(module_name, (int)strlen(module_name), CHECK); assert(module_sym != NULL, "Failed to obtain Symbol for module name"); ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym); ! char* class_path = (xpatch_args->at(i))->path_string(); int len = (int)strlen(class_path); int end = 0; // Iterate over the module's class path entries for (int start = 0; start < len; start = end) { while (class_path[end] && class_path[end] != os::path_separator()[0]) { --- 684,711 ---- delete checker; return result; } #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() { Thread* THREAD = Thread::current(); ! GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix(); ! int num_of_entries = patch_mod_args->length(); ! // Set up the boot loader's patch_mod_entries list ! _patch_mod_entries = new (ResourceObj::C_HEAP, mtModule) GrowableArray<ModuleClassPathList*>(num_of_entries, true); for (int i = 0; i < num_of_entries; i++) { ! const char* module_name = (patch_mod_args->at(i))->module_name(); Symbol* const module_sym = SymbolTable::lookup(module_name, (int)strlen(module_name), CHECK); assert(module_sym != NULL, "Failed to obtain Symbol for module name"); ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym); ! char* class_path = (patch_mod_args->at(i))->path_string(); int len = (int)strlen(class_path); int end = 0; // Iterate over the module's class path entries for (int start = 0; start < len; start = end) { while (class_path[end] && class_path[end] != os::path_separator()[0]) {
*** 731,744 **** while (class_path[end] == os::path_separator()[0]) { end++; } } ! // Record the module into the list of -Xpatch entries only if // valid ClassPathEntrys have been created if (module_cpl->module_first_entry() != NULL) { ! _xpatch_entries->push(module_cpl); } } } void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) { --- 731,744 ---- while (class_path[end] == os::path_separator()[0]) { end++; } } ! // Record the module into the list of --patch-module entries only if // valid ClassPathEntrys have been created if (module_cpl->module_first_entry() != NULL) { ! _patch_mod_entries->push(module_cpl); } } } void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) {
*** 973,988 **** void ClassLoader::print_bootclasspath() { ClassPathEntry* e; tty->print("[bootclasspath= "); ! // Print -Xpatch module/path specifications first ! if (_xpatch_entries != NULL) { ResourceMark rm; ! int num_of_entries = _xpatch_entries->length(); for (int i = 0; i < num_of_entries; i++) { ! ModuleClassPathList* mpl = _xpatch_entries->at(i); tty->print("%s=", mpl->module_name()->as_C_string()); e = mpl->module_first_entry(); while (e != NULL) { tty->print("%s", e->name()); e = e->next(); --- 973,988 ---- void ClassLoader::print_bootclasspath() { ClassPathEntry* e; tty->print("[bootclasspath= "); ! // Print --patch-module module/path specifications first ! if (_patch_mod_entries != NULL) { ResourceMark rm; ! int num_of_entries = _patch_mod_entries->length(); for (int i = 0; i < num_of_entries; i++) { ! ModuleClassPathList* mpl = _patch_mod_entries->at(i); tty->print("%s=", mpl->module_name()->as_C_string()); e = mpl->module_first_entry(); while (e != NULL) { tty->print("%s", e->name()); e = e->next();
*** 1320,1351 **** ClassFileStream* stream = NULL; s2 classpath_index = 0; ClassPathEntry* e = NULL; // If DumpSharedSpaces is true, boot loader visibility boundaries are set ! // to be _first_entry to the end (all path entries). No -Xpatch entries are ! // included since CDS and AppCDS are not supported if -Xpatch is specified. // // If search_append_only is true, boot loader visibility boundaries are // set to be _first_append_entry to the end. This includes: // [-Xbootclasspath/a]; [jvmti appended entries] // // If both DumpSharedSpaces and search_append_only are false, boot loader // visibility boundaries are set to be _first_entry to the entry before // the _first_append_entry. This would include: ! // [-Xpatch:<module>=<file>(<pathsep><file>)*]; [exploded build | jimage] // // DumpSharedSpaces and search_append_only are mutually exclusive and cannot // be true at the same time. assert(!(DumpSharedSpaces && search_append_only), "DumpSharedSpaces and search_append_only are both true"); ! // Load Attempt #1: -Xpatch ! // Determine the class' defining module. If it appears in the _xpatch_entries, // attempt to load the class from those locations specific to the module. ! // Note: The -Xpatch entries are never searched if the boot loader's // visibility boundary is limited to only searching the append entries. ! if (_xpatch_entries != NULL && !search_append_only && !DumpSharedSpaces) { // Find the module in the boot loader's module entry table PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), THREAD); ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL; // If the module system has not defined java.base yet, then --- 1320,1351 ---- ClassFileStream* stream = NULL; s2 classpath_index = 0; ClassPathEntry* e = NULL; // If DumpSharedSpaces is true, boot loader visibility boundaries are set ! // to be _first_entry to the end (all path entries). No --patch-module entries are ! // included since CDS and AppCDS are not supported if --patch-module is specified. // // If search_append_only is true, boot loader visibility boundaries are // set to be _first_append_entry to the end. This includes: // [-Xbootclasspath/a]; [jvmti appended entries] // // If both DumpSharedSpaces and search_append_only are false, boot loader // visibility boundaries are set to be _first_entry to the entry before // the _first_append_entry. This would include: ! // [--patch-module=<module>=<file>(<pathsep><file>)*]; [exploded build | jimage] // // DumpSharedSpaces and search_append_only are mutually exclusive and cannot // be true at the same time. assert(!(DumpSharedSpaces && search_append_only), "DumpSharedSpaces and search_append_only are both true"); ! // Load Attempt #1: --patch-module ! // Determine the class' defining module. If it appears in the _patch_mod_entries, // attempt to load the class from those locations specific to the module. ! // Note: The --patch-module entries are never searched if the boot loader's // visibility boundary is limited to only searching the append entries. ! if (_patch_mod_entries != NULL && !search_append_only && !DumpSharedSpaces) { // Find the module in the boot loader's module entry table PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), THREAD); ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL; // If the module system has not defined java.base yet, then
*** 1359,1393 **** mod_entry = ModuleEntryTable::javabase_module(); } // The module must be a named module if (mod_entry != NULL && mod_entry->is_named()) { ! int num_of_entries = _xpatch_entries->length(); const Symbol* class_module_name = mod_entry->name(); ! // Loop through all the xpatch entries looking for module for (int i = 0; i < num_of_entries; i++) { ! ModuleClassPathList* module_cpl = _xpatch_entries->at(i); Symbol* module_cpl_name = module_cpl->module_name(); if (module_cpl_name->fast_compare(class_module_name) == 0) { // Class' module has been located, attempt to load // the class from the module's ClassPathEntry list. e = module_cpl->module_first_entry(); while (e != NULL) { stream = e->open_stream(file_name, CHECK_NULL); // No context.check is required since both CDS ! // and AppCDS are turned off if -Xpatch is specified. if (NULL != stream) { break; } e = e->next(); } ! // If the module was located in the xpatch entries, break out // even if the class was not located successfully from that module's // ClassPathEntry list. There will not be another valid entry for ! // that module in the _xpatch_entries array. break; } } } } --- 1359,1393 ---- mod_entry = ModuleEntryTable::javabase_module(); } // The module must be a named module if (mod_entry != NULL && mod_entry->is_named()) { ! int num_of_entries = _patch_mod_entries->length(); const Symbol* class_module_name = mod_entry->name(); ! // Loop through all the patch_mod entries looking for module for (int i = 0; i < num_of_entries; i++) { ! ModuleClassPathList* module_cpl = _patch_mod_entries->at(i); Symbol* module_cpl_name = module_cpl->module_name(); if (module_cpl_name->fast_compare(class_module_name) == 0) { // Class' module has been located, attempt to load // the class from the module's ClassPathEntry list. e = module_cpl->module_first_entry(); while (e != NULL) { stream = e->open_stream(file_name, CHECK_NULL); // No context.check is required since both CDS ! // and AppCDS are turned off if --patch-module is specified. if (NULL != stream) { break; } e = e->next(); } ! // If the module was located in the patch_mod entries, break out // even if the class was not located successfully from that module's // ClassPathEntry list. There will not be another valid entry for ! // that module in the _patch_mod_entries array. break; } } } }
*** 1596,1610 **** ClassLoader::initialize(); } // Complete the ClassPathEntry setup for the boot loader void classLoader_init2() { ! // Setup the list of module/path pairs for -Xpatch processing // This must be done after the SymbolTable is created in order // to use fast_compare on module names instead of a string compare. ! if (Arguments::get_xpatchprefix() != NULL) { ! ClassLoader::setup_xpatch_entries(); } // Determine if this is an exploded build ClassLoader::set_has_jimage(); } --- 1596,1610 ---- ClassLoader::initialize(); } // Complete the ClassPathEntry setup for the boot loader void classLoader_init2() { ! // Setup the list of module/path pairs for --patch-module processing // This must be done after the SymbolTable is created in order // to use fast_compare on module names instead of a string compare. ! if (Arguments::get_patch_mod_prefix() != NULL) { ! ClassLoader::setup_patch_mod_entries(); } // Determine if this is an exploded build ClassLoader::set_has_jimage(); }
*** 1656,1666 **** void ClassLoader::set_has_jimage() { // Determine if this is an exploded build. When looking for // the jimage file, only search the piece of the boot // loader's boot class path which contains [exploded build | jimage]. ! // Do not search the boot loader's xpatch entries or append path. ClassPathEntry* e = _first_entry; ClassPathEntry* last_e = _first_append_entry; while ((e != NULL) && (e != last_e)) { JImageFile *jimage = e->jimage(); if (jimage != NULL && e->is_jrt()) { --- 1656,1666 ---- void ClassLoader::set_has_jimage() { // Determine if this is an exploded build. When looking for // the jimage file, only search the piece of the boot // loader's boot class path which contains [exploded build | jimage]. ! // Do not search the boot loader's patch-module entries or append path. ClassPathEntry* e = _first_entry; ClassPathEntry* last_e = _first_append_entry; while ((e != NULL) && (e != last_e)) { JImageFile *jimage = e->jimage(); if (jimage != NULL && e->is_jrt()) {
< prev index next >