mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8207778: Add locking to ModuleEntry and PackageEntry tables
Restructure ClassLoaderDataGraph code to simplify using locks in SystemDictionary::do_unloading() Reviewed-by: lfoltan, coleenp
This commit is contained in:
parent
092e9e4f81
commit
83b2fb5b0d
7 changed files with 37 additions and 28 deletions
|
@ -1418,27 +1418,6 @@ bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
|
|||
}
|
||||
|
||||
if (seen_dead_loader) {
|
||||
data = _head;
|
||||
while (data != NULL) {
|
||||
// Remove entries in the dictionary of live class loader that have
|
||||
// initiated loading classes in a dead class loader.
|
||||
if (data->dictionary() != NULL) {
|
||||
data->dictionary()->do_unloading();
|
||||
}
|
||||
// Walk a ModuleEntry's reads, and a PackageEntry's exports
|
||||
// lists to determine if there are modules on those lists that are now
|
||||
// dead and should be removed. A module's life cycle is equivalent
|
||||
// to its defining class loader's life cycle. Since a module is
|
||||
// considered dead if its class loader is dead, these walks must
|
||||
// occur after each class loader's aliveness is determined.
|
||||
if (data->packages() != NULL) {
|
||||
data->packages()->purge_all_package_exports();
|
||||
}
|
||||
if (data->modules_defined()) {
|
||||
data->modules()->purge_all_module_reads();
|
||||
}
|
||||
data = data->next();
|
||||
}
|
||||
JFR_ONLY(post_class_unload_events();)
|
||||
}
|
||||
|
||||
|
@ -1447,6 +1426,32 @@ bool ClassLoaderDataGraph::do_unloading(bool do_cleaning) {
|
|||
return seen_dead_loader;
|
||||
}
|
||||
|
||||
// There's at least one dead class loader. Purge refererences of healthy module
|
||||
// reads lists and package export lists to modules belonging to dead loaders.
|
||||
void ClassLoaderDataGraph::clean_module_and_package_info() {
|
||||
ClassLoaderData* data = _head;
|
||||
while (data != NULL) {
|
||||
// Remove entries in the dictionary of live class loader that have
|
||||
// initiated loading classes in a dead class loader.
|
||||
if (data->dictionary() != NULL) {
|
||||
data->dictionary()->do_unloading();
|
||||
}
|
||||
// Walk a ModuleEntry's reads, and a PackageEntry's exports
|
||||
// lists to determine if there are modules on those lists that are now
|
||||
// dead and should be removed. A module's life cycle is equivalent
|
||||
// to its defining class loader's life cycle. Since a module is
|
||||
// considered dead if its class loader is dead, these walks must
|
||||
// occur after each class loader's aliveness is determined.
|
||||
if (data->packages() != NULL) {
|
||||
data->packages()->purge_all_package_exports();
|
||||
}
|
||||
if (data->modules_defined()) {
|
||||
data->modules()->purge_all_module_reads();
|
||||
}
|
||||
data = data->next();
|
||||
}
|
||||
}
|
||||
|
||||
void ClassLoaderDataGraph::purge() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
|
||||
ClassLoaderData* list = _unloading;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue