src/share/vm/gc_implementation/g1/g1OopClosures.hpp

Print this page
rev 5917 : 8027559: Decrease code size and templatizing in G1ParCopyClosure::do_oop_work
Summary: Move methods that are not dependent on any of G1ParCopyClosure's template parameters into G1ParCopyHelper. Further remove unused methods and members of the class hierarchy.
Reviewed-by:

*** 46,61 **** }; class G1ParClosureSuper : public OopsInHeapRegionClosure { protected: G1CollectedHeap* _g1; - G1RemSet* _g1_rem; - ConcurrentMark* _cm; G1ParScanThreadState* _par_scan_state; uint _worker_id; - bool _during_initial_mark; - bool _mark_in_progress; public: G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); bool apply_to_weak_ref_discovered_field() { return true; } }; --- 46,57 ----
*** 131,146 **** virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; // Add back base class for metadata class G1ParCopyHelper : public G1ParClosureSuper { Klass* _scanned_klass; public: ! G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : ! _scanned_klass(NULL), ! G1ParClosureSuper(g1, par_scan_state) {} void set_scanned_klass(Klass* k) { _scanned_klass = k; } template <class T> void do_klass_barrier(T* p, oop new_obj); }; --- 127,151 ---- virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; // Add back base class for metadata class G1ParCopyHelper : public G1ParClosureSuper { + protected: Klass* _scanned_klass; + ConcurrentMark* _cm; + + // Mark the object if it's not already marked. This is used to mark + // objects pointed to by roots that are guaranteed not to move + // during the GC (i.e., non-CSet objects). It is MT-safe. + void mark_object(oop obj); + // Mark the object if it's not already marked. This is used to mark + // objects pointed to by roots that have been forwarded during a + // GC. It is MT-safe. + void mark_forwarded_object(oop from_obj, oop to_obj); public: ! G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); void set_scanned_klass(Klass* k) { _scanned_klass = k; } template <class T> void do_klass_barrier(T* p, oop new_obj); };
*** 148,167 **** class G1ParCopyClosure : public G1ParCopyHelper { G1ParScanClosure _scanner; template <class T> void do_oop_work(T* p); protected: - // Mark the object if it's not already marked. This is used to mark - // objects pointed to by roots that are guaranteed not to move - // during the GC (i.e., non-CSet objects). It is MT-safe. - void mark_object(oop obj); - - // Mark the object if it's not already marked. This is used to mark - // objects pointed to by roots that have been forwarded during a - // GC. It is MT-safe. - void mark_forwarded_object(oop from_obj, oop to_obj); - oop copy_to_survivor_space(oop obj); public: G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, ReferenceProcessor* rp) : --- 153,162 ----
*** 170,182 **** assert(_ref_processor == NULL, "sanity"); } G1ParScanClosure* scanner() { return &_scanner; } ! template <class T> void do_oop_nv(T* p) { ! do_oop_work(p); ! } virtual void do_oop(oop* p) { do_oop_nv(p); } virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; typedef G1ParCopyClosure<G1BarrierNone, false> G1ParScanExtRootClosure; --- 165,175 ---- assert(_ref_processor == NULL, "sanity"); } G1ParScanClosure* scanner() { return &_scanner; } ! template <class T> void do_oop_nv(T* p) { do_oop_work(p); } virtual void do_oop(oop* p) { do_oop_nv(p); } virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; typedef G1ParCopyClosure<G1BarrierNone, false> G1ParScanExtRootClosure;