src/hotspot/share/classfile/modules.cpp
changeset 53471 525f212f1bda
parent 53441 5c2c9555afc1
child 53664 2f4c2bc90b22
equal deleted inserted replaced
53470:9459533ef916 53471:525f212f1bda
   206       package_table->verify_javabase_packages(pkg_list);
   206       package_table->verify_javabase_packages(pkg_list);
   207 
   207 
   208       // loop through and add any new packages for java.base
   208       // loop through and add any new packages for java.base
   209       for (int x = 0; x < pkg_list->length(); x++) {
   209       for (int x = 0; x < pkg_list->length(); x++) {
   210         // Some of java.base's packages were added early in bootstrapping, ignore duplicates.
   210         // Some of java.base's packages were added early in bootstrapping, ignore duplicates.
   211         PackageEntry* pkg =
   211         package_table->locked_create_entry_if_not_exist(pkg_list->at(x),
   212           package_table->locked_create_entry_or_null(pkg_list->at(x),
   212                                                         ModuleEntryTable::javabase_moduleEntry());
   213                                                      ModuleEntryTable::javabase_moduleEntry());
   213         assert(package_table->locked_lookup_only(pkg_list->at(x)) != NULL,
   214         assert(pkg != NULL || package_table->locked_lookup_only(pkg_list->at(x)) != NULL,
       
   215                "Unable to create a " JAVA_BASE_NAME " package entry");
   214                "Unable to create a " JAVA_BASE_NAME " package entry");
   216         // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
   215         // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
   217         // the Symbol* that was created above for each package. The refcount was incremented
   216         // the Symbol* that was created above for each package. The refcount was incremented
   218         // by SymbolTable::new_symbol and as well by the PackageEntry creation.
   217         // by SymbolTable::new_symbol and as well by the PackageEntry creation.
   219         pkg_list->at(x)->decrement_refcount();
   218         pkg_list->at(x)->decrement_refcount();
   400       }
   399       }
   401     }  // if (num_packages > 0)...
   400     }  // if (num_packages > 0)...
   402 
   401 
   403     // Add the module and its packages.
   402     // Add the module and its packages.
   404     if (!dupl_modules && existing_pkg == NULL) {
   403     if (!dupl_modules && existing_pkg == NULL) {
   405       // Create the entry for this module in the class loader's module entry table.
   404       if (module_table->lookup_only(module_symbol) == NULL) {
   406       ModuleEntry* module_entry = module_table->locked_create_entry_or_null(module_handle,
   405         // Create the entry for this module in the class loader's module entry table.
       
   406         ModuleEntry* module_entry = module_table->locked_create_entry(module_handle,
   407                                     (is_open == JNI_TRUE), module_symbol,
   407                                     (is_open == JNI_TRUE), module_symbol,
   408                                     version_symbol, location_symbol, loader_data);
   408                                     version_symbol, location_symbol, loader_data);
   409 
   409         assert(module_entry != NULL, "module_entry creation failed");
   410       if (module_entry == NULL) {
   410 
   411         dupl_modules = true;
       
   412       } else {
       
   413         // Add the packages.
   411         // Add the packages.
   414         assert(pkg_list->length() == 0 || package_table != NULL, "Bad package table");
   412         assert(pkg_list->length() == 0 || package_table != NULL, "Bad package table");
   415         PackageEntry* pkg;
       
   416         for (int y = 0; y < pkg_list->length(); y++) {
   413         for (int y = 0; y < pkg_list->length(); y++) {
   417           pkg = package_table->locked_create_entry_or_null(pkg_list->at(y), module_entry);
   414           package_table->locked_create_entry(pkg_list->at(y), module_entry);
   418           assert(pkg != NULL, "Unable to create a module's package entry");
       
   419 
   415 
   420           // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
   416           // Unable to have a GrowableArray of TempNewSymbol.  Must decrement the refcount of
   421           // the Symbol* that was created above for each package. The refcount was incremented
   417           // the Symbol* that was created above for each package. The refcount was incremented
   422           // by SymbolTable::new_symbol and as well by the PackageEntry creation.
   418           // by SymbolTable::new_symbol and as well by the PackageEntry creation.
   423           pkg_list->at(y)->decrement_refcount();
   419           pkg_list->at(y)->decrement_refcount();
   424         }
   420         }
   425 
   421 
   426         // Store pointer to ModuleEntry record in java.lang.Module object.
   422         // Store pointer to ModuleEntry record in java.lang.Module object.
   427         java_lang_Module::set_module_entry(module_handle(), module_entry);
   423         java_lang_Module::set_module_entry(module_handle(), module_entry);
       
   424       } else {
       
   425          dupl_modules = true;
   428       }
   426       }
   429     }
   427     }
   430   }  // Release the lock
   428   }  // Release the lock
   431 
   429 
   432   // any errors ?
   430   // any errors ?