diff --git a/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp b/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp index 1ceca1734c57fd1a46979734796a9a69b902f5c9..cde213284a87911f94fccdd596bc34226ac99afd 100644 --- a/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp +++ b/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp @@ -98,116 +98,4 @@ public: _closure_app_seconds(0.0) { } }; -class BufferingOopsInGenClosure: public OopsInGenClosure { - BufferingOopClosure _boc; - OopsInGenClosure* _oc; - protected: - template inline void do_oop_work(T* p) { - assert(generation()->is_in_reserved((void*)p), "Must be in!"); - _boc.do_oop(p); - } - public: - BufferingOopsInGenClosure(OopsInGenClosure *oc) : - _boc(oc), _oc(oc) {} - - virtual void do_oop(narrowOop* p) { do_oop_work(p); } - virtual void do_oop(oop* p) { do_oop_work(p); } - - void done() { - _boc.done(); - } - - double closure_app_seconds () { - return _boc.closure_app_seconds(); - } - - void set_generation(Generation* gen) { - OopsInGenClosure::set_generation(gen); - _oc->set_generation(gen); - } - - void reset_generation() { - // Make sure we finish the current work with the current generation. - _boc.done(); - OopsInGenClosure::reset_generation(); - _oc->reset_generation(); - } - -}; - - -class BufferingOopsInHeapRegionClosure: public OopsInHeapRegionClosure { -private: - enum PrivateConstants { - BufferLength = 1024 - }; - - StarTask _buffer[BufferLength]; - StarTask* _buffer_top; - StarTask* _buffer_curr; - - HeapRegion* _hr_buffer[BufferLength]; - HeapRegion** _hr_curr; - - OopsInHeapRegionClosure* _oc; - double _closure_app_seconds; - - void process_buffer () { - - assert((_hr_curr - _hr_buffer) == (_buffer_curr - _buffer), - "the two lengths should be the same"); - - double start = os::elapsedTime(); - HeapRegion** hr_curr = _hr_buffer; - HeapRegion* hr_prev = NULL; - for (StarTask* curr = _buffer; curr < _buffer_curr; ++curr) { - HeapRegion* region = *hr_curr; - if (region != hr_prev) { - _oc->set_region(region); - hr_prev = region; - } - if (curr->is_narrow()) { - assert(UseCompressedOops, "Error"); - _oc->do_oop((narrowOop*)(*curr)); - } else { - _oc->do_oop((oop*)(*curr)); - } - ++hr_curr; - } - _buffer_curr = _buffer; - _hr_curr = _hr_buffer; - _closure_app_seconds += (os::elapsedTime() - start); - } - -public: - virtual void do_oop(narrowOop* p) { do_oop_work(p); } - virtual void do_oop( oop* p) { do_oop_work(p); } - - template void do_oop_work(T* p) { - if (_buffer_curr == _buffer_top) { - assert(_hr_curr > _hr_buffer, "_hr_curr should be consistent with _buffer_curr"); - process_buffer(); - } - StarTask new_ref(p); - *_buffer_curr = new_ref; - ++_buffer_curr; - *_hr_curr = _from; - ++_hr_curr; - } - void done () { - if (_buffer_curr > _buffer) { - assert(_hr_curr > _hr_buffer, "_hr_curr should be consistent with _buffer_curr"); - process_buffer(); - } - } - double closure_app_seconds () { - return _closure_app_seconds; - } - BufferingOopsInHeapRegionClosure (OopsInHeapRegionClosure *oc) : - _oc(oc), - _buffer_curr(_buffer), _buffer_top(_buffer + BufferLength), - _hr_curr(_hr_buffer), - _closure_app_seconds(0.0) { } -}; - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_BUFFERINGOOPCLOSURE_HPP diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 32ec934590c612edd8ea19dae794f390b61f1c9b..6ed0244214b28ec7b88fae6cb4509d232413066e 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -50,8 +50,8 @@ #include "gc_implementation/shared/gcTraceTime.hpp" #include "gc_implementation/shared/isGCActiveMark.hpp" #include "memory/gcLocker.inline.hpp" -#include "memory/genOopClosures.inline.hpp" #include "memory/generationSpec.hpp" +#include "memory/iterator.hpp" #include "memory/referenceProcessor.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.pcgc.inline.hpp" @@ -3096,11 +3096,7 @@ const char* G1CollectedHeap::top_at_mark_start_str(VerifyOption vo) { return NULL; // keep some compilers happy } -// TODO: VerifyRootsClosure extends OopsInGenClosure so that we can -// pass it as the perm_blk to SharedHeap::process_strong_roots. -// When process_strong_roots stop calling perm_blk->younger_refs_iterate -// we can change this closure to extend the simpler OopClosure. -class VerifyRootsClosure: public OopsInGenClosure { +class VerifyRootsClosure: public OopClosure { private: G1CollectedHeap* _g1h; VerifyOption _vo; @@ -3136,7 +3132,7 @@ public: void do_oop(narrowOop* p) { do_oop_nv(p); } }; -class G1VerifyCodeRootOopClosure: public OopsInGenClosure { +class G1VerifyCodeRootOopClosure: public OopClosure { G1CollectedHeap* _g1h; OopClosure* _root_cl; nmethod* _nm; @@ -4670,8 +4666,8 @@ G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, _during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()), _mark_in_progress(_g1->mark_in_progress()) { } -template -void G1ParCopyClosure::mark_object(oop obj) { +template +void G1ParCopyClosure::mark_object(oop obj) { #ifdef ASSERT HeapRegion* hr = _g1->heap_region_containing(obj); assert(hr != NULL, "sanity"); @@ -4682,8 +4678,8 @@ void G1ParCopyClosure::mark_object(oop _cm->grayRoot(obj, (size_t) obj->size(), _worker_id); } -template -void G1ParCopyClosure +template +void G1ParCopyClosure ::mark_forwarded_object(oop from_obj, oop to_obj) { #ifdef ASSERT assert(from_obj->is_forwarded(), "from obj should be forwarded"); @@ -4706,8 +4702,8 @@ void G1ParCopyClosure _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id); } -template -oop G1ParCopyClosure +template +oop G1ParCopyClosure ::copy_to_survivor_space(oop old) { size_t word_sz = old->size(); HeapRegion* from_region = _g1->heap_region_containing_raw(old); @@ -4803,13 +4799,11 @@ void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) { } } -template +template template -void G1ParCopyClosure +void G1ParCopyClosure ::do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); - assert(barrier != G1BarrierRS || obj != NULL, - "Precondition: G1BarrierRS implies obj is non-NULL"); assert(_worker_id == _par_scan_state->queue_num(), "sanity"); @@ -4829,10 +4823,7 @@ void G1ParCopyClosure mark_forwarded_object(obj, forwardee); } - // When scanning the RS, we only care about objs in CS. - if (barrier == G1BarrierRS) { - _par_scan_state->update_rs(_from, p, _worker_id); - } else if (barrier == G1BarrierKlass) { + if (barrier == G1BarrierKlass) { do_klass_barrier(p, forwardee); } } else { @@ -4847,14 +4838,10 @@ void G1ParCopyClosure if (barrier == G1BarrierEvac && obj != NULL) { _par_scan_state->update_rs(_from, p, _worker_id); } - - if (do_gen_barrier && obj != NULL) { - par_do_barrier(p); - } } -template void G1ParCopyClosure::do_oop_work(oop* p); -template void G1ParCopyClosure::do_oop_work(narrowOop* p); +template void G1ParCopyClosure::do_oop_work(oop* p); +template void G1ParCopyClosure::do_oop_work(narrowOop* p); template void G1ParScanPartialArrayClosure::do_oop_nv(T* p) { assert(has_partial_array_mask(p), "invariant"); diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 52b12e02f39d49db2c9d360ce6a09927f0a9a2b5..3529c60ea9ba4d60889ec9867eb17d488d7517b1 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -209,7 +209,7 @@ class G1CollectedHeap : public SharedHeap { friend class OldGCAllocRegion; // Closures used in implementation. - template + template friend class G1ParCopyClosure; friend class G1IsAliveClosure; friend class G1EvacuateFollowersClosure; diff --git a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp index b616cb9eb4c067715252eba1b12ab6277aa88d95..414b82f95bcf98cbbd49e28affc9a2fd82466fc2 100644 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp @@ -38,7 +38,7 @@ class ReferenceProcessor; // A class that scans oops in a given heap region (much as OopsInGenClosure // scans oops in a generation.) -class OopsInHeapRegionClosure: public OopsInGenClosure { +class OopsInHeapRegionClosure: public ExtendedOopClosure { protected: HeapRegion* _from; public: @@ -131,7 +131,7 @@ class G1ParCopyHelper : public G1ParClosureSuper { template void do_klass_barrier(T* p, oop new_obj); }; -template +template class G1ParCopyClosure : public G1ParCopyHelper { G1ParScanClosure _scanner; template void do_oop_work(T* p); @@ -166,22 +166,16 @@ public: virtual void do_oop(narrowOop* p) { do_oop_nv(p); } }; -typedef G1ParCopyClosure G1ParScanExtRootClosure; -typedef G1ParCopyClosure G1ParScanMetadataClosure; +typedef G1ParCopyClosure G1ParScanExtRootClosure; +typedef G1ParCopyClosure G1ParScanMetadataClosure; -typedef G1ParCopyClosure G1ParScanAndMarkExtRootClosure; -typedef G1ParCopyClosure G1ParScanAndMarkClosure; -typedef G1ParCopyClosure G1ParScanAndMarkMetadataClosure; - -// The following closure types are no longer used but are retained -// for historical reasons: -// typedef G1ParCopyClosure G1ParScanHeapRSClosure; -// typedef G1ParCopyClosure G1ParScanAndMarkHeapRSClosure; +typedef G1ParCopyClosure G1ParScanAndMarkExtRootClosure; +typedef G1ParCopyClosure G1ParScanAndMarkMetadataClosure; // The following closure type is defined in g1_specialized_oop_closures.hpp: // -// typedef G1ParCopyClosure G1ParScanHeapEvacClosure; +// typedef G1ParCopyClosure G1ParScanHeapEvacClosure; // We use a separate closure to handle references during evacuation // failure processing. @@ -189,7 +183,7 @@ typedef G1ParCopyClosure G1ParScanAndMarkMetadataCl // (since that closure no longer assumes that the references it // handles point into the collection set). -typedef G1ParCopyClosure G1ParScanHeapEvacFailureClosure; +typedef G1ParCopyClosure G1ParScanHeapEvacFailureClosure; class FilterIntoCSClosure: public ExtendedOopClosure { G1CollectedHeap* _g1; diff --git a/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp b/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp index e16561ccce36f8ef7a0d7f6dec48f09a57e1bd72..e10a658a54314cc6d86dd44a20e194cdd7e4abb4 100644 --- a/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp +++ b/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp @@ -33,18 +33,17 @@ // Forward declarations. enum G1Barrier { G1BarrierNone, - G1BarrierRS, G1BarrierEvac, G1BarrierKlass }; -template +template class G1ParCopyClosure; class G1ParScanClosure; class G1ParPushHeapRSClosure; -typedef G1ParCopyClosure G1ParScanHeapEvacClosure; +typedef G1ParCopyClosure G1ParScanHeapEvacClosure; class FilterIntoCSClosure; class FilterOutOfRegionClosure;