This commit is contained in:
Rachel Protacio 2016-12-05 18:00:34 +00:00
commit da0b1b46e0
5 changed files with 39 additions and 3 deletions

@ -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.

@ -418,6 +418,8 @@ class ClassLoader: AllStatic {
}
}
static bool is_in_patch_mod_entries(Symbol* module_name);
#if INCLUDE_CDS
// Sharing dump and restore

@ -301,6 +301,14 @@ ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle
entry->set_version(version);
entry->set_location(location);
if (ClassLoader::is_in_patch_mod_entries(name)) {
entry->set_is_patched();
if (log_is_enabled(Trace, modules, patch)) {
ResourceMark rm;
log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
}
}
TRACE_INIT_MODULE_ID(entry);
return entry;

@ -63,6 +63,7 @@ private:
bool _can_read_all_unnamed;
bool _has_default_read_edges; // JVMTI redefine/retransform support
bool _must_walk_reads; // walk module's reads list at GC safepoints to purge out dead modules
bool _is_patched; // whether the module is patched via --patch-module
TRACE_DEFINE_TRACE_ID_FIELD;
enum {MODULE_READS_SIZE = 101}; // Initial size of list of modules that the module can read.
@ -77,6 +78,7 @@ public:
_can_read_all_unnamed = false;
_has_default_read_edges = false;
_must_walk_reads = false;
_is_patched = false;
}
Symbol* name() const { return literal(); }
@ -131,6 +133,13 @@ public:
return prev;
}
void set_is_patched() {
_is_patched = true;
}
bool is_patched() {
return _is_patched;
}
ModuleEntry* next() const {
return (ModuleEntry*)HashtableEntry<Symbol*, mtModule>::next();
}

@ -90,6 +90,7 @@
LOG_TAG(oopmap) \
LOG_TAG(os) \
LOG_TAG(pagesize) \
LOG_TAG(patch) \
LOG_TAG(path) \
LOG_TAG(phases) \
LOG_TAG(plab) \