mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
Move the exception throw outside of the block containing the lock Reviewed-by: dholmes, kbarrett, lfoltan
This commit is contained in:
parent
9d801b98a7
commit
737a2a5946
1 changed files with 26 additions and 21 deletions
|
@ -237,35 +237,40 @@ static void define_javabase_module(jobject module, jstring version,
|
|||
// Ensure java.base's ModuleEntry has been created
|
||||
assert(ModuleEntryTable::javabase_module() != NULL, "No ModuleEntry for java.base");
|
||||
|
||||
bool duplicate_javabase = false;
|
||||
{
|
||||
MutexLocker m1(Module_lock, THREAD);
|
||||
|
||||
if (ModuleEntryTable::javabase_defined()) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Module java.base is already defined");
|
||||
}
|
||||
duplicate_javabase = true;
|
||||
} else {
|
||||
|
||||
// Verify that all java.base packages created during bootstrapping are in
|
||||
// pkg_list. If any are not in pkg_list, than a non-java.base class was
|
||||
// loaded erroneously pre java.base module definition.
|
||||
package_table->verify_javabase_packages(pkg_list);
|
||||
// Verify that all java.base packages created during bootstrapping are in
|
||||
// pkg_list. If any are not in pkg_list, than a non-java.base class was
|
||||
// loaded erroneously pre java.base module definition.
|
||||
package_table->verify_javabase_packages(pkg_list);
|
||||
|
||||
// loop through and add any new packages for java.base
|
||||
PackageEntry* pkg;
|
||||
for (int x = 0; x < pkg_list->length(); x++) {
|
||||
// Some of java.base's packages were added early in bootstrapping, ignore duplicates.
|
||||
if (package_table->lookup_only(pkg_list->at(x)) == NULL) {
|
||||
pkg = package_table->locked_create_entry_or_null(pkg_list->at(x), ModuleEntryTable::javabase_module());
|
||||
assert(pkg != NULL, "Unable to create a java.base package entry");
|
||||
// loop through and add any new packages for java.base
|
||||
PackageEntry* pkg;
|
||||
for (int x = 0; x < pkg_list->length(); x++) {
|
||||
// Some of java.base's packages were added early in bootstrapping, ignore duplicates.
|
||||
if (package_table->lookup_only(pkg_list->at(x)) == NULL) {
|
||||
pkg = package_table->locked_create_entry_or_null(pkg_list->at(x), ModuleEntryTable::javabase_module());
|
||||
assert(pkg != NULL, "Unable to create a java.base package entry");
|
||||
}
|
||||
// Unable to have a GrowableArray of TempNewSymbol. Must decrement the refcount of
|
||||
// the Symbol* that was created above for each package. The refcount was incremented
|
||||
// by SymbolTable::new_symbol and as well by the PackageEntry creation.
|
||||
pkg_list->at(x)->decrement_refcount();
|
||||
}
|
||||
// Unable to have a GrowableArray of TempNewSymbol. Must decrement the refcount of
|
||||
// the Symbol* that was created above for each package. The refcount was incremented
|
||||
// by SymbolTable::new_symbol and as well by the PackageEntry creation.
|
||||
pkg_list->at(x)->decrement_refcount();
|
||||
}
|
||||
|
||||
// Finish defining java.base's ModuleEntry
|
||||
ModuleEntryTable::finalize_javabase(module_handle, version_symbol, location_symbol);
|
||||
// Finish defining java.base's ModuleEntry
|
||||
ModuleEntryTable::finalize_javabase(module_handle, version_symbol, location_symbol);
|
||||
}
|
||||
}
|
||||
if (duplicate_javabase) {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Module java.base is already defined");
|
||||
}
|
||||
|
||||
log_debug(modules)("define_javabase_module(): Definition of module: java.base,"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue