Concurrent class unloading
380 "an interface can only be a subklass of Object");
381 Klass* prev_first_subklass = super->subklass();
382 if (prev_first_subklass != NULL) {
383 // set our sibling to be the superklass' previous first subklass
384 set_next_sibling(prev_first_subklass);
385 }
386 // make ourselves the superklass' first subklass
387 super->set_subklass(this);
388 debug_only(verify();)
389 }
390
391 oop Klass::holder_phantom() const {
392 return class_loader_data()->holder_phantom();
393 }
394
395 void Klass::clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses) {
396 if (!ClassUnloading || !unloading_occurred) {
397 return;
398 }
399
400 Klass* root = SystemDictionary::Object_klass();
401 Stack<Klass*, mtGC> stack;
402
403 stack.push(root);
404 while (!stack.is_empty()) {
405 Klass* current = stack.pop();
406
407 assert(current->is_loader_alive(), "just checking, this should be live");
408
409 // Find and set the first alive subklass
410 Klass* sub = current->subklass();
411 while (sub != NULL && !sub->is_loader_alive()) {
412 #ifndef PRODUCT
413 if (log_is_enabled(Trace, class, unload)) {
414 ResourceMark rm;
415 log_trace(class, unload)("unlinking class (subclass): %s", sub->external_name());
416 }
417 #endif
418 sub = sub->next_sibling();
|
380 "an interface can only be a subklass of Object");
381 Klass* prev_first_subklass = super->subklass();
382 if (prev_first_subklass != NULL) {
383 // set our sibling to be the superklass' previous first subklass
384 set_next_sibling(prev_first_subklass);
385 }
386 // make ourselves the superklass' first subklass
387 super->set_subklass(this);
388 debug_only(verify();)
389 }
390
391 oop Klass::holder_phantom() const {
392 return class_loader_data()->holder_phantom();
393 }
394
395 void Klass::clean_weak_klass_links(bool unloading_occurred, bool clean_alive_klasses) {
396 if (!ClassUnloading || !unloading_occurred) {
397 return;
398 }
399
400 MutexLockerEx ml(UseZGC ? Compile_lock : NULL);
401 Klass* root = SystemDictionary::Object_klass();
402 Stack<Klass*, mtGC> stack;
403
404 stack.push(root);
405 while (!stack.is_empty()) {
406 Klass* current = stack.pop();
407
408 assert(current->is_loader_alive(), "just checking, this should be live");
409
410 // Find and set the first alive subklass
411 Klass* sub = current->subklass();
412 while (sub != NULL && !sub->is_loader_alive()) {
413 #ifndef PRODUCT
414 if (log_is_enabled(Trace, class, unload)) {
415 ResourceMark rm;
416 log_trace(class, unload)("unlinking class (subclass): %s", sub->external_name());
417 }
418 #endif
419 sub = sub->next_sibling();
|