563 if (data->dictionary() != NULL) {
564 data->dictionary()->do_unloading();
565 }
566 // Walk a ModuleEntry's reads, and a PackageEntry's exports
567 // lists to determine if there are modules on those lists that are now
568 // dead and should be removed. A module's life cycle is equivalent
569 // to its defining class loader's life cycle. Since a module is
570 // considered dead if its class loader is dead, these walks must
571 // occur after each class loader's aliveness is determined.
572 if (data->packages() != NULL) {
573 data->packages()->purge_all_package_exports();
574 }
575 if (data->modules_defined()) {
576 data->modules()->purge_all_module_reads();
577 }
578 data = data->next();
579 }
580 }
581
582 void ClassLoaderDataGraph::purge() {
583 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
584 ClassLoaderData* list = _unloading;
585 _unloading = NULL;
586 ClassLoaderData* next = list;
587 bool classes_unloaded = false;
588 while (next != NULL) {
589 ClassLoaderData* purge_me = next;
590 next = purge_me->next();
591 delete purge_me;
592 classes_unloaded = true;
593 }
594 if (classes_unloaded) {
595 Metaspace::purge();
596 set_metaspace_oom(false);
597 }
598 }
599
600 int ClassLoaderDataGraph::resize_if_needed() {
601 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
602 int resized = 0;
603 if (Dictionary::does_any_dictionary_needs_resizing()) {
|
563 if (data->dictionary() != NULL) {
564 data->dictionary()->do_unloading();
565 }
566 // Walk a ModuleEntry's reads, and a PackageEntry's exports
567 // lists to determine if there are modules on those lists that are now
568 // dead and should be removed. A module's life cycle is equivalent
569 // to its defining class loader's life cycle. Since a module is
570 // considered dead if its class loader is dead, these walks must
571 // occur after each class loader's aliveness is determined.
572 if (data->packages() != NULL) {
573 data->packages()->purge_all_package_exports();
574 }
575 if (data->modules_defined()) {
576 data->modules()->purge_all_module_reads();
577 }
578 data = data->next();
579 }
580 }
581
582 void ClassLoaderDataGraph::purge() {
583 assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
584 ClassLoaderData* list = _unloading;
585 _unloading = NULL;
586 ClassLoaderData* next = list;
587 bool classes_unloaded = false;
588 while (next != NULL) {
589 ClassLoaderData* purge_me = next;
590 next = purge_me->next();
591 delete purge_me;
592 classes_unloaded = true;
593 }
594 if (classes_unloaded) {
595 Metaspace::purge();
596 set_metaspace_oom(false);
597 }
598 }
599
600 int ClassLoaderDataGraph::resize_if_needed() {
601 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
602 int resized = 0;
603 if (Dictionary::does_any_dictionary_needs_resizing()) {
|