src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp

Print this page

        

*** 24,33 **** --- 24,34 ---- #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP #include "memory/genOopClosures.hpp" + #include "memory/iterator.hpp" ///////////////////////////////////////////////////////////////// // Closures used by ConcurrentMarkSweepGeneration's collector ///////////////////////////////////////////////////////////////// class ConcurrentMarkSweepGeneration;
*** 46,101 **** oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ do_oop(obj); \ } \ } ! // Applies the given oop closure to all oops in all klasses visited. ! class CMKlassClosure : public KlassClosure { ! friend class CMSOopClosure; ! friend class CMSOopsInGenClosure; ! ! OopClosure* _oop_closure; ! ! // Used when _oop_closure couldn't be set in an initialization list. ! void initialize(OopClosure* oop_closure) { ! assert(_oop_closure == NULL, "Should only be called once"); ! _oop_closure = oop_closure; ! } ! public: ! CMKlassClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) { } ! ! void do_klass(Klass* k); ! }; ! ! // The base class for all CMS marking closures. ! // It's used to proxy through the metadata to the oops defined in them. ! class CMSOopClosure: public ExtendedOopClosure { ! CMKlassClosure _klass_closure; ! public: ! CMSOopClosure() : ExtendedOopClosure() { ! _klass_closure.initialize(this); ! } ! CMSOopClosure(ReferenceProcessor* rp) : ExtendedOopClosure(rp) { ! _klass_closure.initialize(this); ! } ! ! virtual bool do_metadata() { return do_metadata_nv(); } ! inline bool do_metadata_nv() { return true; } ! ! virtual void do_klass(Klass* k); ! void do_klass_nv(Klass* k); ! ! virtual void do_class_loader_data(ClassLoaderData* cld); ! }; ! ! // TODO: This duplication of the CMSOopClosure class is only needed because ! // some CMS OopClosures derive from OopsInGenClosure. It would be good ! // to get rid of them completely. ! class CMSOopsInGenClosure: public OopsInGenClosure { ! CMKlassClosure _klass_closure; public: ! CMSOopsInGenClosure() { _klass_closure.initialize(this); } virtual bool do_metadata() { return do_metadata_nv(); } inline bool do_metadata_nv() { return true; } --- 47,63 ---- oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ do_oop(obj); \ } \ } ! // TODO: This duplication of the MetadataAwareOopClosure class is only needed ! // because some CMS OopClosures derive from OopsInGenClosure. It would be ! // good to get rid of them completely. ! class MetadataAwareOopsInGenClosure: public OopsInGenClosure { ! KlassToOopClosure _klass_closure; public: ! MetadataAwareOopsInGenClosure() { _klass_closure.initialize(this); } virtual bool do_metadata() { return do_metadata_nv(); } inline bool do_metadata_nv() { return true; }
*** 104,114 **** void do_klass_nv(Klass* k); virtual void do_class_loader_data(ClassLoaderData* cld); }; ! class MarkRefsIntoClosure: public CMSOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _bitMap; protected: DO_OOP_WORK_DEFN --- 66,76 ---- void do_klass_nv(Klass* k); virtual void do_class_loader_data(ClassLoaderData* cld); }; ! class MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _bitMap; protected: DO_OOP_WORK_DEFN
*** 116,126 **** MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); }; ! class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _bitMap; protected: DO_OOP_WORK_DEFN --- 78,88 ---- MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap); virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); }; ! class Par_MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _bitMap; protected: DO_OOP_WORK_DEFN
*** 130,140 **** virtual void do_oop(narrowOop* p); }; // A variant of the above used in certain kinds of CMS // marking verification. ! class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _verification_bm; CMSBitMap* _cms_bm; protected: --- 92,102 ---- virtual void do_oop(narrowOop* p); }; // A variant of the above used in certain kinds of CMS // marking verification. ! class MarkRefsIntoVerifyClosure: public MetadataAwareOopsInGenClosure { private: const MemRegion _span; CMSBitMap* _verification_bm; CMSBitMap* _cms_bm; protected:
*** 145,155 **** virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); }; // The non-parallel version (the parallel version appears further below). ! class PushAndMarkClosure: public CMSOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bit_map; CMSBitMap* _mod_union_table; --- 107,117 ---- virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); }; // The non-parallel version (the parallel version appears further below). ! class PushAndMarkClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bit_map; CMSBitMap* _mod_union_table;
*** 175,185 **** // reference processor are currently all shared. Access to // these shared mutable structures must use appropriate // synchronization (for instance, via CAS). The marking stack // used in the non-parallel case above is here replaced with // an OopTaskQueue structure to allow efficient work stealing. ! class Par_PushAndMarkClosure: public CMSOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bit_map; OopTaskQueue* _work_queue; --- 137,147 ---- // reference processor are currently all shared. Access to // these shared mutable structures must use appropriate // synchronization (for instance, via CAS). The marking stack // used in the non-parallel case above is here replaced with // an OopTaskQueue structure to allow efficient work stealing. ! class Par_PushAndMarkClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bit_map; OopTaskQueue* _work_queue;
*** 196,206 **** inline void do_oop_nv(oop* p) { Par_PushAndMarkClosure::do_oop_work(p); } inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); } }; // The non-parallel version (the parallel version appears further below). ! class MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure { private: MemRegion _span; CMSBitMap* _bit_map; CMSMarkStack* _mark_stack; PushAndMarkClosure _pushAndMarkClosure; --- 158,168 ---- inline void do_oop_nv(oop* p) { Par_PushAndMarkClosure::do_oop_work(p); } inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); } }; // The non-parallel version (the parallel version appears further below). ! class MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure { private: MemRegion _span; CMSBitMap* _bit_map; CMSMarkStack* _mark_stack; PushAndMarkClosure _pushAndMarkClosure;
*** 237,247 **** // In this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit // stack and the bitMap are shared, so access needs to be suitably // synchronized. An OopTaskQueue structure, supporting efficient // work stealing, replaces a CMSMarkStack for storing grey objects. ! class Par_MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure { private: MemRegion _span; CMSBitMap* _bit_map; OopTaskQueue* _work_queue; const uint _low_water_mark; --- 199,209 ---- // In this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit // stack and the bitMap are shared, so access needs to be suitably // synchronized. An OopTaskQueue structure, supporting efficient // work stealing, replaces a CMSMarkStack for storing grey objects. ! class Par_MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure { private: MemRegion _span; CMSBitMap* _bit_map; OopTaskQueue* _work_queue; const uint _low_water_mark;
*** 263,273 **** }; // This closure is used during the concurrent marking phase // following the first checkpoint. Its use is buried in // the closure MarkFromRootsClosure. ! class PushOrMarkClosure: public CMSOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bitMap; CMSMarkStack* _markStack; --- 225,235 ---- }; // This closure is used during the concurrent marking phase // following the first checkpoint. Its use is buried in // the closure MarkFromRootsClosure. ! class PushOrMarkClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; MemRegion _span; CMSBitMap* _bitMap; CMSMarkStack* _markStack;
*** 296,306 **** // A parallel (MT) version of the above. // This closure is used during the concurrent marking phase // following the first checkpoint. Its use is buried in // the closure Par_MarkFromRootsClosure. ! class Par_PushOrMarkClosure: public CMSOopClosure { private: CMSCollector* _collector; MemRegion _whole_span; MemRegion _span; // local chunk CMSBitMap* _bit_map; --- 258,268 ---- // A parallel (MT) version of the above. // This closure is used during the concurrent marking phase // following the first checkpoint. Its use is buried in // the closure Par_MarkFromRootsClosure. ! class Par_PushOrMarkClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; MemRegion _whole_span; MemRegion _span; // local chunk CMSBitMap* _bit_map;
*** 336,346 **** // given objects (transitively) as being reachable/live. // This is currently used during the (weak) reference object // processing phase of the CMS final checkpoint step, as // well as during the concurrent precleaning of the discovered // reference lists. ! class CMSKeepAliveClosure: public CMSOopClosure { private: CMSCollector* _collector; const MemRegion _span; CMSMarkStack* _mark_stack; CMSBitMap* _bit_map; --- 298,308 ---- // given objects (transitively) as being reachable/live. // This is currently used during the (weak) reference object // processing phase of the CMS final checkpoint step, as // well as during the concurrent precleaning of the discovered // reference lists. ! class CMSKeepAliveClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; const MemRegion _span; CMSMarkStack* _mark_stack; CMSBitMap* _bit_map;
*** 356,366 **** virtual void do_oop(narrowOop* p); inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } }; ! class CMSInnerParMarkAndPushClosure: public CMSOopClosure { private: CMSCollector* _collector; MemRegion _span; OopTaskQueue* _work_queue; CMSBitMap* _bit_map; --- 318,328 ---- virtual void do_oop(narrowOop* p); inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } }; ! class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure { private: CMSCollector* _collector; MemRegion _span; OopTaskQueue* _work_queue; CMSBitMap* _bit_map;
*** 377,387 **** }; // A parallel (MT) version of the above, used when // reference processing is parallel; the only difference // is in the do_oop method. ! class CMSParKeepAliveClosure: public CMSOopClosure { private: MemRegion _span; OopTaskQueue* _work_queue; CMSBitMap* _bit_map; CMSInnerParMarkAndPushClosure --- 339,349 ---- }; // A parallel (MT) version of the above, used when // reference processing is parallel; the only difference // is in the do_oop method. ! class CMSParKeepAliveClosure: public MetadataAwareOopClosure { private: MemRegion _span; OopTaskQueue* _work_queue; CMSBitMap* _bit_map; CMSInnerParMarkAndPushClosure