284 entry->set_hash(hash); 285 entry->set_literal(name); 286 287 // Initialize fields specific to a ModuleEntry 288 entry->init(); 289 if (name != NULL) { 290 name->increment_refcount(); 291 } else { 292 // Unnamed modules can read all other unnamed modules. 293 entry->set_can_read_all_unnamed(); 294 } 295 296 if (!module_handle.is_null()) { 297 entry->set_module(loader_data->add_handle(module_handle)); 298 } 299 300 entry->set_loader_data(loader_data); 301 entry->set_version(version); 302 entry->set_location(location); 303 304 TRACE_INIT_MODULE_ID(entry); 305 306 return entry; 307 } 308 309 void ModuleEntryTable::add_entry(int index, ModuleEntry* new_entry) { 310 assert(Module_lock->owned_by_self(), "should have the Module_lock"); 311 Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry); 312 } 313 314 ModuleEntry* ModuleEntryTable::locked_create_entry_or_null(Handle module_handle, 315 Symbol* module_name, 316 Symbol* module_version, 317 Symbol* module_location, 318 ClassLoaderData* loader_data) { 319 assert(module_name != NULL, "ModuleEntryTable locked_create_entry_or_null should never be called for unnamed module."); 320 assert(Module_lock->owned_by_self(), "should have the Module_lock"); 321 // Check if module already exists. 322 if (lookup_only(module_name) != NULL) { 323 return NULL; | 284 entry->set_hash(hash); 285 entry->set_literal(name); 286 287 // Initialize fields specific to a ModuleEntry 288 entry->init(); 289 if (name != NULL) { 290 name->increment_refcount(); 291 } else { 292 // Unnamed modules can read all other unnamed modules. 293 entry->set_can_read_all_unnamed(); 294 } 295 296 if (!module_handle.is_null()) { 297 entry->set_module(loader_data->add_handle(module_handle)); 298 } 299 300 entry->set_loader_data(loader_data); 301 entry->set_version(version); 302 entry->set_location(location); 303 304 if (ClassLoader::is_in_patch_mod_entries(name)) { 305 entry->set_is_patched(); 306 if (log_is_enabled(Trace, modules, patch)) { 307 ResourceMark rm; 308 log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string()); 309 } 310 } 311 312 TRACE_INIT_MODULE_ID(entry); 313 314 return entry; 315 } 316 317 void ModuleEntryTable::add_entry(int index, ModuleEntry* new_entry) { 318 assert(Module_lock->owned_by_self(), "should have the Module_lock"); 319 Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry); 320 } 321 322 ModuleEntry* ModuleEntryTable::locked_create_entry_or_null(Handle module_handle, 323 Symbol* module_name, 324 Symbol* module_version, 325 Symbol* module_location, 326 ClassLoaderData* loader_data) { 327 assert(module_name != NULL, "ModuleEntryTable locked_create_entry_or_null should never be called for unnamed module."); 328 assert(Module_lock->owned_by_self(), "should have the Module_lock"); 329 // Check if module already exists. 330 if (lookup_only(module_name) != NULL) { 331 return NULL; |