< prev index next >

src/share/vm/classfile/moduleEntry.cpp

Print this page

        

@@ -164,10 +164,16 @@
                          (name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
     }
   }
 }
 
+// Set whether the module is open, i.e. all its packages are unqualifiedly exported
+void ModuleEntry::set_is_open(bool is_open) {
+  assert_lock_strong(Module_lock);
+  _is_open = is_open;
+}
+
 bool ModuleEntry::has_reads() const {
   assert_locked_or_safepoint(Module_lock);
   return ((_reads != NULL) && !_reads->is_empty());
 }
 

@@ -267,27 +273,28 @@
   // Each ModuleEntryTable has exactly one unnamed module
   if (loader_data->is_the_null_class_loader_data()) {
     // For the boot loader, the java.lang.reflect.Module for the unnamed module
     // is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At
     // this point initially create the ModuleEntry for the unnamed module.
-    _unnamed_module = new_entry(0, Handle(NULL), NULL, NULL, NULL, loader_data);
+    _unnamed_module = new_entry(0, Handle(NULL), true, NULL, NULL, NULL, loader_data);
   } else {
     // For all other class loaders the java.lang.reflect.Module for their
     // corresponding unnamed module can be found in the java.lang.ClassLoader object.
     oop module = java_lang_ClassLoader::unnamedModule(loader_data->class_loader());
-    _unnamed_module = new_entry(0, Handle(module), NULL, NULL, NULL, loader_data);
+    _unnamed_module = new_entry(0, Handle(module), true, NULL, NULL, NULL, loader_data);
 
     // Store pointer to the ModuleEntry in the unnamed module's java.lang.reflect.Module
     // object.
     java_lang_reflect_Module::set_module_entry(module, _unnamed_module);
   }
 
   // Add to bucket 0, no name to hash on
   add_entry(0, _unnamed_module);
 }
 
-ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle, Symbol* name,
+ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle,
+                                         bool is_open, Symbol* name,
                                          Symbol* version, Symbol* location,
                                          ClassLoaderData* loader_data) {
   assert(Module_lock->owned_by_self(), "should have the Module_lock");
   ModuleEntry* entry = (ModuleEntry*) NEW_C_HEAP_ARRAY(char, entry_size(), mtModule);
 

@@ -310,10 +317,11 @@
   }
 
   entry->set_loader_data(loader_data);
   entry->set_version(version);
   entry->set_location(location);
+  entry->set_is_open(is_open);
 
   if (ClassLoader::is_in_patch_mod_entries(name)) {
     entry->set_is_patched();
     if (log_is_enabled(Trace, modules, patch)) {
       ResourceMark rm;

@@ -330,21 +338,22 @@
   assert(Module_lock->owned_by_self(), "should have the Module_lock");
   Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry);
 }
 
 ModuleEntry* ModuleEntryTable::locked_create_entry_or_null(Handle module_handle,
+                                                           bool is_open,
                                                            Symbol* module_name,
                                                            Symbol* module_version,
                                                            Symbol* module_location,
                                                            ClassLoaderData* loader_data) {
   assert(module_name != NULL, "ModuleEntryTable locked_create_entry_or_null should never be called for unnamed module.");
   assert(Module_lock->owned_by_self(), "should have the Module_lock");
   // Check if module already exists.
   if (lookup_only(module_name) != NULL) {
     return NULL;
   } else {
-    ModuleEntry* entry = new_entry(compute_hash(module_name), module_handle, module_name,
+    ModuleEntry* entry = new_entry(compute_hash(module_name), module_handle, is_open, module_name,
                                    module_version, module_location, loader_data);
     add_entry(index_for(module_name), entry);
     return entry;
   }
 }
< prev index next >