--- old/src/hotspot/share/classfile/classLoaderData.hpp 2017-09-25 13:05:13.946055735 -0400 +++ new/src/hotspot/share/classfile/classLoaderData.hpp 2017-09-25 13:05:13.518335126 -0400 @@ -87,9 +87,9 @@ static void purge(); static void clear_claimed_marks(); // oops do - static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); - static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); - static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); + static void oops_do(OopClosure* f, bool must_claim); + static void keep_alive_oops_do(OopClosure* blk, bool must_claim); + static void always_strong_oops_do(OopClosure* blk, bool must_claim); // cld do static void cld_do(CLDClosure* cl); static void cld_unloading_do(CLDClosure* cl); @@ -234,6 +234,11 @@ // Used for anonymous classes and the boot class // loader. _keep_alive does not need to be volatile or // atomic since there is one unique CLD per anonymous class. + + // Remembered sets support for the oops in the class loader data. + jbyte _modified_oops; // Card Table Equivalent (YC/CMS support) + jbyte _accumulated_modified_oops; // Mod Union Equivalent (CMS support) + 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. @@ -276,6 +281,19 @@ bool claimed() const { return _claimed == 1; } bool claim(); + // The CLD are not placed in the Heap, so the Card Table or + // the Mod Union Table can't be used to mark when CLD have modified oops. + // The CT and MUT bits saves this information for the whole class loader data. + void clear_modified_oops() { _modified_oops = 0; } + public: + void record_modified_oops() { _modified_oops = 1; } + bool has_modified_oops() { return _modified_oops == 1; } + + void accumulate_modified_oops() { if (has_modified_oops()) _accumulated_modified_oops = 1; } + void clear_accumulated_modified_oops() { _accumulated_modified_oops = 0; } + bool has_accumulated_modified_oops() { return _accumulated_modified_oops == 1; } + private: + void unload(); bool keep_alive() const { return _keep_alive > 0; } void classes_do(void f(Klass*)); @@ -346,8 +364,7 @@ inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); } - // Used when tracing from klasses. - void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); + void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false); void classes_do(KlassClosure* klass_closure); Klass* klasses() { return _klasses; }