85 public: |
85 public: |
86 static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); |
86 static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); |
87 static void purge(); |
87 static void purge(); |
88 static void clear_claimed_marks(); |
88 static void clear_claimed_marks(); |
89 // oops do |
89 // oops do |
90 static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
90 static void oops_do(OopClosure* f, bool must_claim); |
91 static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
91 static void keep_alive_oops_do(OopClosure* blk, bool must_claim); |
92 static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
92 static void always_strong_oops_do(OopClosure* blk, bool must_claim); |
93 // cld do |
93 // cld do |
94 static void cld_do(CLDClosure* cl); |
94 static void cld_do(CLDClosure* cl); |
95 static void cld_unloading_do(CLDClosure* cl); |
95 static void cld_unloading_do(CLDClosure* cl); |
96 static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
96 static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
97 static void keep_alive_cld_do(CLDClosure* cl); |
97 static void keep_alive_cld_do(CLDClosure* cl); |
228 Metaspace * volatile _metaspace; // Meta-space where meta-data defined by the |
228 Metaspace * volatile _metaspace; // Meta-space where meta-data defined by the |
229 // classes in the class loader are allocated. |
229 // classes in the class loader are allocated. |
230 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. |
230 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. |
231 bool _unloading; // true if this class loader goes away |
231 bool _unloading; // true if this class loader goes away |
232 bool _is_anonymous; // if this CLD is for an anonymous class |
232 bool _is_anonymous; // if this CLD is for an anonymous class |
|
233 |
|
234 // Remembered sets support for the oops in the class loader data. |
|
235 bool _modified_oops; // Card Table Equivalent (YC/CMS support) |
|
236 bool _accumulated_modified_oops; // Mod Union Equivalent (CMS support) |
|
237 |
233 s2 _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
238 s2 _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
234 // Used for anonymous classes and the boot class |
239 // Used for anonymous classes and the boot class |
235 // loader. _keep_alive does not need to be volatile or |
240 // loader. _keep_alive does not need to be volatile or |
236 // atomic since there is one unique CLD per anonymous class. |
241 // atomic since there is one unique CLD per anonymous class. |
|
242 |
237 volatile int _claimed; // true if claimed, for example during GC traces. |
243 volatile int _claimed; // true if claimed, for example during GC traces. |
238 // To avoid applying oop closure more than once. |
244 // To avoid applying oop closure more than once. |
239 // Has to be an int because we cas it. |
245 // Has to be an int because we cas it. |
240 ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which |
246 ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which |
241 // have the same life cycle of the corresponding ClassLoader. |
247 // have the same life cycle of the corresponding ClassLoader. |
273 |
279 |
274 // GC interface. |
280 // GC interface. |
275 void clear_claimed() { _claimed = 0; } |
281 void clear_claimed() { _claimed = 0; } |
276 bool claimed() const { return _claimed == 1; } |
282 bool claimed() const { return _claimed == 1; } |
277 bool claim(); |
283 bool claim(); |
|
284 |
|
285 // The CLD are not placed in the Heap, so the Card Table or |
|
286 // the Mod Union Table can't be used to mark when CLD have modified oops. |
|
287 // The CT and MUT bits saves this information for the whole class loader data. |
|
288 void clear_modified_oops() { _modified_oops = false; } |
|
289 public: |
|
290 void record_modified_oops() { _modified_oops = true; } |
|
291 bool has_modified_oops() { return _modified_oops; } |
|
292 |
|
293 void accumulate_modified_oops() { if (has_modified_oops()) _accumulated_modified_oops = true; } |
|
294 void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; } |
|
295 bool has_accumulated_modified_oops() { return _accumulated_modified_oops; } |
|
296 private: |
278 |
297 |
279 void unload(); |
298 void unload(); |
280 bool keep_alive() const { return _keep_alive > 0; } |
299 bool keep_alive() const { return _keep_alive > 0; } |
281 void classes_do(void f(Klass*)); |
300 void classes_do(void f(Klass*)); |
282 void loaded_classes_do(KlassClosure* klass_closure); |
301 void loaded_classes_do(KlassClosure* klass_closure); |
344 void inc_keep_alive(); |
363 void inc_keep_alive(); |
345 void dec_keep_alive(); |
364 void dec_keep_alive(); |
346 |
365 |
347 inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); } |
366 inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); } |
348 |
367 |
349 // Used when tracing from klasses. |
368 void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false); |
350 void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
|
351 |
369 |
352 void classes_do(KlassClosure* klass_closure); |
370 void classes_do(KlassClosure* klass_closure); |
353 Klass* klasses() { return _klasses; } |
371 Klass* klasses() { return _klasses; } |
354 |
372 |
355 JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; } |
373 JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; } |