77 static ClassLoaderData* _unloading; |
77 static ClassLoaderData* _unloading; |
78 // CMS support. |
78 // CMS support. |
79 static ClassLoaderData* _saved_head; |
79 static ClassLoaderData* _saved_head; |
80 static ClassLoaderData* _saved_unloading; |
80 static ClassLoaderData* _saved_unloading; |
81 static bool _should_purge; |
81 static bool _should_purge; |
|
82 |
|
83 // Set if there's anything to purge in the deallocate lists or previous versions |
|
84 // during a safepoint after class unloading in a full GC. |
|
85 static bool _should_clean_deallocate_lists; |
|
86 static bool _safepoint_cleanup_needed; |
|
87 |
82 // OOM has been seen in metaspace allocation. Used to prevent some |
88 // OOM has been seen in metaspace allocation. Used to prevent some |
83 // allocations until class unloading |
89 // allocations until class unloading |
84 static bool _metaspace_oom; |
90 static bool _metaspace_oom; |
85 |
91 |
86 static volatile size_t _num_instance_classes; |
92 static volatile size_t _num_instance_classes; |
87 static volatile size_t _num_array_classes; |
93 static volatile size_t _num_array_classes; |
88 |
94 |
89 static ClassLoaderData* add_to_graph(Handle class_loader, bool anonymous); |
95 static ClassLoaderData* add_to_graph(Handle class_loader, bool anonymous); |
90 static ClassLoaderData* add(Handle class_loader, bool anonymous); |
96 static ClassLoaderData* add(Handle class_loader, bool anonymous); |
|
97 |
91 public: |
98 public: |
92 static ClassLoaderData* find_or_create(Handle class_loader); |
99 static ClassLoaderData* find_or_create(Handle class_loader); |
93 static void purge(); |
100 static void purge(); |
94 static void clear_claimed_marks(); |
101 static void clear_claimed_marks(); |
95 // oops do |
102 // oops do |
114 static void modules_unloading_do(void f(ModuleEntry*)); |
121 static void modules_unloading_do(void f(ModuleEntry*)); |
115 static void packages_do(void f(PackageEntry*)); |
122 static void packages_do(void f(PackageEntry*)); |
116 static void packages_unloading_do(void f(PackageEntry*)); |
123 static void packages_unloading_do(void f(PackageEntry*)); |
117 static void loaded_classes_do(KlassClosure* klass_closure); |
124 static void loaded_classes_do(KlassClosure* klass_closure); |
118 static void classes_unloading_do(void f(Klass* const)); |
125 static void classes_unloading_do(void f(Klass* const)); |
119 static bool do_unloading(bool clean_previous_versions); |
126 static bool do_unloading(bool do_cleaning); |
|
127 |
|
128 // Expose state to avoid logging overhead in safepoint cleanup tasks. |
|
129 static inline bool should_clean_metaspaces_and_reset(); |
|
130 static void set_should_clean_deallocate_lists() { _should_clean_deallocate_lists = true; } |
|
131 static void clean_deallocate_lists(bool purge_previous_versions); |
|
132 static void walk_metadata_and_clean_metaspaces(); |
120 |
133 |
121 // dictionary do |
134 // dictionary do |
122 // Iterate over all klasses in dictionary, but |
135 // Iterate over all klasses in dictionary, but |
123 // just the classes from defining class loaders. |
136 // just the classes from defining class loaders. |
124 static void dictionary_classes_do(void f(InstanceKlass*)); |
137 static void dictionary_classes_do(void f(InstanceKlass*)); |
295 void methods_do(void f(Method*)); |
308 void methods_do(void f(Method*)); |
296 void modules_do(void f(ModuleEntry*)); |
309 void modules_do(void f(ModuleEntry*)); |
297 void packages_do(void f(PackageEntry*)); |
310 void packages_do(void f(PackageEntry*)); |
298 |
311 |
299 // Deallocate free list during class unloading. |
312 // Deallocate free list during class unloading. |
300 void free_deallocate_list(); // for the classes that are not unloaded |
313 void free_deallocate_list(); // for the classes that are not unloaded |
301 void unload_deallocate_list(); // for the classes that are unloaded |
314 void free_deallocate_list_C_heap_structures(); // for the classes that are unloaded |
302 |
315 |
303 // Allocate out of this class loader data |
316 // Allocate out of this class loader data |
304 MetaWord* allocate(size_t size); |
317 MetaWord* allocate(size_t size); |
305 |
318 |
306 Dictionary* create_dictionary(); |
319 Dictionary* create_dictionary(); |