8168850: Mark module entries that have been specified by --patch-module

Adds a boolean to ModuleEntry to specify whether the module has been patched using the command line --patch-module

Reviewed-by: jiangli, lfoltan, dholmes
This commit is contained in:
Rachel Protacio 2016-12-05 11:45:20 -05:00
parent 78e6980e1a
commit 83ff43e737
5 changed files with 39 additions and 3 deletions

View file

@ -751,6 +751,21 @@ void ClassLoader::setup_patch_mod_entries() {
}
}
// Determine whether the module has been patched via the command-line
// option --patch-module
bool ClassLoader::is_in_patch_mod_entries(Symbol* module_name) {
if (_patch_mod_entries != NULL && _patch_mod_entries->is_nonempty()) {
int table_len = _patch_mod_entries->length();
for (int i = 0; i < table_len; i++) {
ModuleClassPathList* patch_mod = _patch_mod_entries->at(i);
if (module_name->fast_compare(patch_mod->module_name()) == 0) {
return true;
}
}
}
return false;
}
void ClassLoader::setup_search_path(const char *class_path, bool bootstrap_search) {
int len = (int)strlen(class_path);
int end = 0;
@ -1764,9 +1779,6 @@ void classLoader_init1() {
// Complete the ClassPathEntry setup for the boot loader
void ClassLoader::classLoader_init2(TRAPS) {
// Create the moduleEntry for java.base
create_javabase();
// 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.
@ -1774,6 +1786,10 @@ void ClassLoader::classLoader_init2(TRAPS) {
setup_patch_mod_entries();
}
// Create the ModuleEntry for java.base (must occur after setup_patch_mod_entries
// to successfully determine if java.base has been patched)
create_javabase();
// Setup the initial java.base/path pair for the exploded build entries.
// As more modules are defined during module system initialization, more
// entries will be added to the exploded build array.