499 if (_deallocate_list != NULL) { |
499 if (_deallocate_list != NULL) { |
500 delete _deallocate_list; |
500 delete _deallocate_list; |
501 } |
501 } |
502 } |
502 } |
503 |
503 |
504 /** |
504 // Returns true if this class loader data is for the system class loader. |
505 * Returns true if this class loader data is for the platform class loader. |
505 bool ClassLoaderData::is_system_class_loader_data() const { |
506 */ |
506 return SystemDictionary::is_system_class_loader(class_loader()); |
|
507 } |
|
508 |
|
509 // Returns true if this class loader data is for the platform class loader. |
507 bool ClassLoaderData::is_platform_class_loader_data() const { |
510 bool ClassLoaderData::is_platform_class_loader_data() const { |
508 return SystemDictionary::is_platform_class_loader(class_loader()); |
511 return SystemDictionary::is_platform_class_loader(class_loader()); |
|
512 } |
|
513 |
|
514 // Returns true if this class loader data is one of the 3 builtin |
|
515 // (boot, application/system or platform) class loaders. Note, the |
|
516 // builtin loaders are not freed by a GC. |
|
517 bool ClassLoaderData::is_builtin_class_loader_data() const { |
|
518 Handle classLoaderHandle = class_loader(); |
|
519 return (is_the_null_class_loader_data() || |
|
520 SystemDictionary::is_system_class_loader(classLoaderHandle) || |
|
521 SystemDictionary::is_platform_class_loader(classLoaderHandle)); |
509 } |
522 } |
510 |
523 |
511 Metaspace* ClassLoaderData::metaspace_non_null() { |
524 Metaspace* ClassLoaderData::metaspace_non_null() { |
512 assert(!DumpSharedSpaces, "wrong metaspace!"); |
525 assert(!DumpSharedSpaces, "wrong metaspace!"); |
513 // If the metaspace has not been allocated, create a new one. Might want |
526 // If the metaspace has not been allocated, create a new one. Might want |
955 _saved_unloading = _unloading; |
968 _saved_unloading = _unloading; |
956 |
969 |
957 data = _head; |
970 data = _head; |
958 while (data != NULL) { |
971 while (data != NULL) { |
959 if (data->is_alive(is_alive_closure)) { |
972 if (data->is_alive(is_alive_closure)) { |
960 if (data->packages_defined()) { |
|
961 data->packages()->purge_all_package_exports(); |
|
962 } |
|
963 if (data->modules_defined()) { |
|
964 data->modules()->purge_all_module_reads(); |
|
965 } |
|
966 // clean metaspace |
973 // clean metaspace |
967 if (walk_all_metadata) { |
974 if (walk_all_metadata) { |
968 data->classes_do(InstanceKlass::purge_previous_versions); |
975 data->classes_do(InstanceKlass::purge_previous_versions); |
969 } |
976 } |
970 data->free_deallocate_list(); |
977 data->free_deallocate_list(); |
988 dead->set_next(_unloading); |
995 dead->set_next(_unloading); |
989 _unloading = dead; |
996 _unloading = dead; |
990 } |
997 } |
991 |
998 |
992 if (seen_dead_loader) { |
999 if (seen_dead_loader) { |
|
1000 // Walk a ModuleEntry's reads and a PackageEntry's exports lists |
|
1001 // to determine if there are modules on those lists that are now |
|
1002 // dead and should be removed. A module's life cycle is equivalent |
|
1003 // to its defining class loader's life cycle. Since a module is |
|
1004 // considered dead if its class loader is dead, these walks must |
|
1005 // occur after each class loader's aliveness is determined. |
|
1006 data = _head; |
|
1007 while (data != NULL) { |
|
1008 if (data->packages_defined()) { |
|
1009 data->packages()->purge_all_package_exports(); |
|
1010 } |
|
1011 if (data->modules_defined()) { |
|
1012 data->modules()->purge_all_module_reads(); |
|
1013 } |
|
1014 data = data->next(); |
|
1015 } |
|
1016 |
993 post_class_unload_events(); |
1017 post_class_unload_events(); |
994 } |
1018 } |
995 |
1019 |
996 return seen_dead_loader; |
1020 return seen_dead_loader; |
997 } |
1021 } |