# HG changeset patch # User brutisso # Date 1331887977 -3600 # Node ID 8cf95843833bffc95b5ad78c3e5ebab0a4ebeb3a # Parent 9625585c6047ee7f75007fa3230ecb4975927fa3 7130974: G1: Remove G1ParCopyHelper Reviewed-by: tonyp, johnc diff -r 9625585c6047 -r 8cf95843833b hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Mar 13 11:05:32 2012 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Mar 16 09:52:57 2012 +0100 @@ -4355,7 +4355,8 @@ _during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()), _mark_in_progress(_g1->mark_in_progress()) { } -void G1ParCopyHelper::mark_object(oop obj) { +template +void G1ParCopyClosure::mark_object(oop obj) { #ifdef ASSERT HeapRegion* hr = _g1->heap_region_containing(obj); assert(hr != NULL, "sanity"); @@ -4366,7 +4367,9 @@ _cm->grayRoot(obj, (size_t) obj->size(), _worker_id); } -void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) { +template +void G1ParCopyClosure + ::mark_forwarded_object(oop from_obj, oop to_obj) { #ifdef ASSERT assert(from_obj->is_forwarded(), "from obj should be forwarded"); assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee"); @@ -4388,7 +4391,9 @@ _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id); } -oop G1ParCopyHelper::copy_to_survivor_space(oop old) { +template +oop G1ParCopyClosure + ::copy_to_survivor_space(oop old) { size_t word_sz = old->size(); HeapRegion* from_region = _g1->heap_region_containing_raw(old); // +1 to make the -1 indexes valid... @@ -4457,8 +4462,8 @@ } else { // No point in using the slower heap_region_containing() method, // given that we know obj is in the heap. - _scanner->set_region(_g1->heap_region_containing_raw(obj)); - obj->oop_iterate_backwards(_scanner); + _scanner.set_region(_g1->heap_region_containing_raw(obj)); + obj->oop_iterate_backwards(&_scanner); } } else { _par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz); diff -r 9625585c6047 -r 8cf95843833b hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue Mar 13 11:05:32 2012 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Mar 16 09:52:57 2012 +0100 @@ -199,7 +199,8 @@ friend class OldGCAllocRegion; // Closures used in implementation. - friend class G1ParCopyHelper; + template + friend class G1ParCopyClosure; friend class G1IsAliveClosure; friend class G1EvacuateFollowersClosure; friend class G1ParScanThreadState; diff -r 9625585c6047 -r 8cf95843833b hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Tue Mar 13 11:05:32 2012 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Fri Mar 16 09:52:57 2012 +0100 @@ -118,9 +118,11 @@ virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; +template +class G1ParCopyClosure : public G1ParClosureSuper { + G1ParScanClosure _scanner; + template void do_oop_work(T* p); -class G1ParCopyHelper : public G1ParClosureSuper { - G1ParScanClosure *_scanner; 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 @@ -135,22 +137,10 @@ oop copy_to_survivor_space(oop obj); public: - G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, - G1ParScanClosure *scanner) : - G1ParClosureSuper(g1, par_scan_state), _scanner(scanner) { } -}; - -template -class G1ParCopyClosure : public G1ParCopyHelper { - G1ParScanClosure _scanner; - - template void do_oop_work(T* p); - -public: G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, ReferenceProcessor* rp) : _scanner(g1, par_scan_state, rp), - G1ParCopyHelper(g1, par_scan_state, &_scanner) { + G1ParClosureSuper(g1, par_scan_state) { assert(_ref_processor == NULL, "sanity"); }