51 |
51 |
52 class ClassLoaderData; |
52 class ClassLoaderData; |
53 class JNIMethodBlock; |
53 class JNIMethodBlock; |
54 class JNIHandleBlock; |
54 class JNIHandleBlock; |
55 class Metadebug; |
55 class Metadebug; |
|
56 class ModuleEntry; |
|
57 class PackageEntry; |
|
58 class ModuleEntryTable; |
|
59 class PackageEntryTable; |
56 |
60 |
57 // GC root for walking class loader data created |
61 // GC root for walking class loader data created |
58 |
62 |
59 class ClassLoaderDataGraph : public AllStatic { |
63 class ClassLoaderDataGraph : public AllStatic { |
60 friend class ClassLoaderData; |
64 friend class ClassLoaderData; |
90 static void always_strong_cld_do(CLDClosure* cl); |
94 static void always_strong_cld_do(CLDClosure* cl); |
91 // klass do |
95 // klass do |
92 static void classes_do(KlassClosure* klass_closure); |
96 static void classes_do(KlassClosure* klass_closure); |
93 static void classes_do(void f(Klass* const)); |
97 static void classes_do(void f(Klass* const)); |
94 static void methods_do(void f(Method*)); |
98 static void methods_do(void f(Method*)); |
|
99 static void modules_do(void f(ModuleEntry*)); |
|
100 static void modules_unloading_do(void f(ModuleEntry*)); |
|
101 static void packages_do(void f(PackageEntry*)); |
|
102 static void packages_unloading_do(void f(PackageEntry*)); |
95 static void loaded_classes_do(KlassClosure* klass_closure); |
103 static void loaded_classes_do(KlassClosure* klass_closure); |
96 static void classes_unloading_do(void f(Klass* const)); |
104 static void classes_unloading_do(void f(Klass* const)); |
97 static bool do_unloading(BoolObjectClosure* is_alive, bool clean_previous_versions); |
105 static bool do_unloading(BoolObjectClosure* is_alive, bool clean_previous_versions); |
98 |
106 |
99 // CMS support. |
107 // CMS support. |
170 bool _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
178 bool _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
171 bool _is_anonymous; // if this CLD is for an anonymous class |
179 bool _is_anonymous; // if this CLD is for an anonymous class |
172 volatile int _claimed; // true if claimed, for example during GC traces. |
180 volatile int _claimed; // true if claimed, for example during GC traces. |
173 // To avoid applying oop closure more than once. |
181 // To avoid applying oop closure more than once. |
174 // Has to be an int because we cas it. |
182 // Has to be an int because we cas it. |
|
183 JNIHandleBlock* _handles; // Handles to constant pool arrays, Modules, etc, which |
|
184 // have the same life cycle of the corresponding ClassLoader. |
|
185 |
175 Klass* _klasses; // The classes defined by the class loader. |
186 Klass* _klasses; // The classes defined by the class loader. |
176 |
187 PackageEntryTable* _packages; // The packages defined by the class loader. |
177 JNIHandleBlock* _handles; // Handles to constant pool arrays |
188 ModuleEntryTable* _modules; // The modules defined by the class loader. |
178 |
189 |
179 // These method IDs are created for the class loader and set to NULL when the |
190 // These method IDs are created for the class loader and set to NULL when the |
180 // class loader is unloaded. They are rarely freed, only for redefine classes |
191 // class loader is unloaded. They are rarely freed, only for redefine classes |
181 // and if they lose a data race in InstanceKlass. |
192 // and if they lose a data race in InstanceKlass. |
182 JNIMethodBlock* _jmethod_ids; |
193 JNIMethodBlock* _jmethod_ids; |
216 bool keep_alive() const { return _keep_alive; } |
227 bool keep_alive() const { return _keep_alive; } |
217 void classes_do(void f(Klass*)); |
228 void classes_do(void f(Klass*)); |
218 void loaded_classes_do(KlassClosure* klass_closure); |
229 void loaded_classes_do(KlassClosure* klass_closure); |
219 void classes_do(void f(InstanceKlass*)); |
230 void classes_do(void f(InstanceKlass*)); |
220 void methods_do(void f(Method*)); |
231 void methods_do(void f(Method*)); |
|
232 void modules_do(void f(ModuleEntry*)); |
|
233 void packages_do(void f(PackageEntry*)); |
221 |
234 |
222 // Deallocate free list during class unloading. |
235 // Deallocate free list during class unloading. |
223 void free_deallocate_list(); |
236 void free_deallocate_list(); |
224 |
237 |
225 // Allocate out of this class loader data |
238 // Allocate out of this class loader data |
254 } |
267 } |
255 |
268 |
256 bool is_the_null_class_loader_data() const { |
269 bool is_the_null_class_loader_data() const { |
257 return this == _the_null_class_loader_data; |
270 return this == _the_null_class_loader_data; |
258 } |
271 } |
259 bool is_ext_class_loader_data() const; |
272 bool is_platform_class_loader_data() const; |
260 |
273 |
261 // The Metaspace is created lazily so may be NULL. This |
274 // The Metaspace is created lazily so may be NULL. This |
262 // method will allocate a Metaspace if needed. |
275 // method will allocate a Metaspace if needed. |
263 Metaspace* metaspace_non_null(); |
276 Metaspace* metaspace_non_null(); |
264 |
277 |
291 void dump(outputStream * const out) PRODUCT_RETURN; |
304 void dump(outputStream * const out) PRODUCT_RETURN; |
292 void verify(); |
305 void verify(); |
293 const char* loader_name(); |
306 const char* loader_name(); |
294 |
307 |
295 jobject add_handle(Handle h); |
308 jobject add_handle(Handle h); |
|
309 void remove_handle(jobject h); |
296 void add_class(Klass* k, bool publicize = true); |
310 void add_class(Klass* k, bool publicize = true); |
297 void remove_class(Klass* k); |
311 void remove_class(Klass* k); |
298 bool contains_klass(Klass* k); |
312 bool contains_klass(Klass* k); |
299 void record_dependency(const Klass* to, TRAPS); |
313 void record_dependency(const Klass* to, TRAPS); |
300 void init_dependencies(TRAPS); |
314 void init_dependencies(TRAPS); |
|
315 PackageEntryTable* packages(); |
|
316 bool packages_defined() { return (_packages != NULL); } |
|
317 ModuleEntryTable* modules(); |
|
318 bool modules_defined() { return (_modules != NULL); } |
301 |
319 |
302 void add_to_deallocate_list(Metadata* m); |
320 void add_to_deallocate_list(Metadata* m); |
303 |
321 |
304 static ClassLoaderData* class_loader_data(oop loader); |
322 static ClassLoaderData* class_loader_data(oop loader); |
305 static ClassLoaderData* class_loader_data_or_null(oop loader); |
323 static ClassLoaderData* class_loader_data_or_null(oop loader); |