mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8201537: Remove is_alive closure from Klass::is_loader_alive()
Remove is_alive closure from callers of Klass::is_loader_alive so that cleaning metadata doesn't require GC closure. Reviewed-by: adinn, stefank
This commit is contained in:
parent
4ffd5d45c1
commit
c215aa5889
18 changed files with 130 additions and 174 deletions
|
@ -381,22 +381,7 @@ void Klass::append_to_sibling_list() {
|
|||
debug_only(verify();)
|
||||
}
|
||||
|
||||
bool Klass::is_loader_alive(BoolObjectClosure* is_alive) {
|
||||
#ifdef ASSERT
|
||||
// The class is alive iff the class loader is alive.
|
||||
oop loader = class_loader();
|
||||
bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader);
|
||||
#endif // ASSERT
|
||||
|
||||
// The class is alive if it's mirror is alive (which should be marked if the
|
||||
// loader is alive) unless it's an anoymous class.
|
||||
bool mirror_alive = is_alive->do_object_b(java_mirror());
|
||||
assert(!mirror_alive || loader_alive, "loader must be alive if the mirror is"
|
||||
" but not the other way around with anonymous classes");
|
||||
return mirror_alive;
|
||||
}
|
||||
|
||||
void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive_klasses) {
|
||||
void Klass::clean_weak_klass_links(bool clean_alive_klasses) {
|
||||
if (!ClassUnloading) {
|
||||
return;
|
||||
}
|
||||
|
@ -408,11 +393,11 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive
|
|||
while (!stack.is_empty()) {
|
||||
Klass* current = stack.pop();
|
||||
|
||||
assert(current->is_loader_alive(is_alive), "just checking, this should be live");
|
||||
assert(current->is_loader_alive(), "just checking, this should be live");
|
||||
|
||||
// Find and set the first alive subklass
|
||||
Klass* sub = current->subklass();
|
||||
while (sub != NULL && !sub->is_loader_alive(is_alive)) {
|
||||
while (sub != NULL && !sub->is_loader_alive()) {
|
||||
#ifndef PRODUCT
|
||||
if (log_is_enabled(Trace, class, unload)) {
|
||||
ResourceMark rm;
|
||||
|
@ -428,7 +413,7 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive
|
|||
|
||||
// Find and set the first alive sibling
|
||||
Klass* sibling = current->next_sibling();
|
||||
while (sibling != NULL && !sibling->is_loader_alive(is_alive)) {
|
||||
while (sibling != NULL && !sibling->is_loader_alive()) {
|
||||
if (log_is_enabled(Trace, class, unload)) {
|
||||
ResourceMark rm;
|
||||
log_trace(class, unload)("[Unlinking class (sibling) %s]", sibling->external_name());
|
||||
|
@ -443,12 +428,12 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive
|
|||
// Clean the implementors list and method data.
|
||||
if (clean_alive_klasses && current->is_instance_klass()) {
|
||||
InstanceKlass* ik = InstanceKlass::cast(current);
|
||||
ik->clean_weak_instanceklass_links(is_alive);
|
||||
ik->clean_weak_instanceklass_links();
|
||||
|
||||
// JVMTI RedefineClasses creates previous versions that are not in
|
||||
// the class hierarchy, so process them here.
|
||||
while ((ik = ik->previous_versions()) != NULL) {
|
||||
ik->clean_weak_instanceklass_links(is_alive);
|
||||
ik->clean_weak_instanceklass_links();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue