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