--- a/src/hotspot/share/classfile/classLoaderData.hpp Wed Aug 08 15:11:11 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderData.hpp Wed Aug 08 15:24:21 2018 -0400
@@ -79,6 +79,12 @@
static ClassLoaderData* _saved_head;
static ClassLoaderData* _saved_unloading;
static bool _should_purge;
+
+ // Set if there's anything to purge in the deallocate lists or previous versions
+ // during a safepoint after class unloading in a full GC.
+ static bool _should_clean_deallocate_lists;
+ static bool _safepoint_cleanup_needed;
+
// OOM has been seen in metaspace allocation. Used to prevent some
// allocations until class unloading
static bool _metaspace_oom;
@@ -88,6 +94,7 @@
static ClassLoaderData* add_to_graph(Handle class_loader, bool anonymous);
static ClassLoaderData* add(Handle class_loader, bool anonymous);
+
public:
static ClassLoaderData* find_or_create(Handle class_loader);
static void purge();
@@ -116,7 +123,13 @@
static void packages_unloading_do(void f(PackageEntry*));
static void loaded_classes_do(KlassClosure* klass_closure);
static void classes_unloading_do(void f(Klass* const));
- static bool do_unloading(bool clean_previous_versions);
+ static bool do_unloading(bool do_cleaning);
+
+ // Expose state to avoid logging overhead in safepoint cleanup tasks.
+ static inline bool should_clean_metaspaces_and_reset();
+ static void set_should_clean_deallocate_lists() { _should_clean_deallocate_lists = true; }
+ static void clean_deallocate_lists(bool purge_previous_versions);
+ static void walk_metadata_and_clean_metaspaces();
// dictionary do
// Iterate over all klasses in dictionary, but
@@ -297,8 +310,8 @@
void packages_do(void f(PackageEntry*));
// Deallocate free list during class unloading.
- void free_deallocate_list(); // for the classes that are not unloaded
- void unload_deallocate_list(); // for the classes that are unloaded
+ void free_deallocate_list(); // for the classes that are not unloaded
+ void free_deallocate_list_C_heap_structures(); // for the classes that are unloaded
// Allocate out of this class loader data
MetaWord* allocate(size_t size);