< prev index next >

src/hotspot/share/classfile/classLoaderData.hpp

CLD claiming
   s2 _keep_alive;          // if this CLD is kept alive.
                            // Used for unsafe anonymous classes and the boot class
                            // loader. _keep_alive does not need to be volatile or
                            // atomic since there is one unique CLD per unsafe anonymous class.
 
-  volatile int _claimed;   // true if claimed, for example during GC traces.
-                           // To avoid applying oop closure more than once.
-                           // Has to be an int because we cas it.
+  volatile int _claim_value; // non-zero if claimed, for example during GC traces.
+                             // To avoid applying oop closure more than once.
   ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which
                               // have the same life cycle of the corresponding ClassLoader.
 
   NOT_PRODUCT(volatile int _dependency_count;)  // number of class loader dependencies
 

@@ -329,15 +328,27 MetaWord* allocate(size_t size); Dictionary* create_dictionary(); void initialize_name(Handle class_loader); + public: // GC interface. - void clear_claimed() { _claimed = 0; } - bool claimed() const { return _claimed == 1; } - bool claim(); + + // The "claim_value" is typically used to check if oops_do needs to be applied on + // the CLD or not. Most GCs only perform strong marking during the marking phase, + // in which case the claim value is + enum { + _claim_value_none = 0, + _claim_value_strong = 1, + _claim_value_finalizable = 2 + }; + void clear_claimed() { _claim_value = 0; } + bool claimed() const { return _claim_value != 0; } + bool claim(int claim_value); + int claim_value() const { return _claim_value; } + void set_claim_value(int claim_value) { _claim_value = claim_value; } // Computes if the CLD is alive or not. This is safe to call in concurrent // contexts. bool is_alive() const;
@@ -393,11 +404,11 void inc_keep_alive(); void dec_keep_alive(); void initialize_holder(Handle holder); - void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false); + void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false); void classes_do(KlassClosure* klass_closure); Klass* klasses() { return _klasses; } JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }
< prev index next >