8027746: Remove do_gen_barrier template parameter in G1ParCopyClosure
Summary: Remove the above mentioned template parameter and related unused code. Also remove some classes that are never used.
Reviewed-by: stefank, mgerdin, jwilhelm
--- a/hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp Mon Jan 20 11:47:29 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp Mon Jan 20 11:47:53 2014 +0100
@@ -98,116 +98,4 @@
_closure_app_seconds(0.0) { }
};
-class BufferingOopsInGenClosure: public OopsInGenClosure {
- BufferingOopClosure _boc;
- OopsInGenClosure* _oc;
- protected:
- template <class T> 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 <class T> 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
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Jan 20 11:47:29 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Mon Jan 20 11:47:53 2014 +0100
@@ -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"
@@ -3077,11 +3077,7 @@
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;
@@ -3117,7 +3113,7 @@
void do_oop(narrowOop* p) { do_oop_nv(p); }
};
-class G1VerifyCodeRootOopClosure: public OopsInGenClosure {
+class G1VerifyCodeRootOopClosure: public OopClosure {
G1CollectedHeap* _g1h;
OopClosure* _root_cl;
nmethod* _nm;
@@ -4651,8 +4647,8 @@
_during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()),
_mark_in_progress(_g1->mark_in_progress()) { }
-template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
-void G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>::mark_object(oop obj) {
+template <G1Barrier barrier, bool do_mark_object>
+void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) {
#ifdef ASSERT
HeapRegion* hr = _g1->heap_region_containing(obj);
assert(hr != NULL, "sanity");
@@ -4663,8 +4659,8 @@
_cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
}
-template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
-void G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>
+template <G1Barrier barrier, bool do_mark_object>
+void G1ParCopyClosure<barrier, do_mark_object>
::mark_forwarded_object(oop from_obj, oop to_obj) {
#ifdef ASSERT
assert(from_obj->is_forwarded(), "from obj should be forwarded");
@@ -4687,8 +4683,8 @@
_cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
}
-template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
-oop G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>
+template <G1Barrier barrier, bool do_mark_object>
+oop G1ParCopyClosure<barrier, do_mark_object>
::copy_to_survivor_space(oop old) {
size_t word_sz = old->size();
HeapRegion* from_region = _g1->heap_region_containing_raw(old);
@@ -4784,13 +4780,11 @@
}
}
-template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
+template <G1Barrier barrier, bool do_mark_object>
template <class T>
-void G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>
+void G1ParCopyClosure<barrier, do_mark_object>
::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");
@@ -4810,10 +4804,7 @@
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 {
@@ -4828,14 +4819,10 @@
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<false, G1BarrierEvac, false>::do_oop_work(oop* p);
-template void G1ParCopyClosure<false, G1BarrierEvac, false>::do_oop_work(narrowOop* p);
+}
+
+template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(oop* p);
+template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(narrowOop* p);
template <class T> void G1ParScanPartialArrayClosure::do_oop_nv(T* p) {
assert(has_partial_array_mask(p), "invariant");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jan 20 11:47:29 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jan 20 11:47:53 2014 +0100
@@ -209,7 +209,7 @@
friend class OldGCAllocRegion;
// Closures used in implementation.
- template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
+ template <G1Barrier barrier, bool do_mark_object>
friend class G1ParCopyClosure;
friend class G1IsAliveClosure;
friend class G1EvacuateFollowersClosure;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Mon Jan 20 11:47:29 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp Mon Jan 20 11:47:53 2014 +0100
@@ -38,7 +38,7 @@
// 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 @@
template <class T> void do_klass_barrier(T* p, oop new_obj);
};
-template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
+template <G1Barrier barrier, bool do_mark_object>
class G1ParCopyClosure : public G1ParCopyHelper {
G1ParScanClosure _scanner;
template <class T> void do_oop_work(T* p);
@@ -166,22 +166,16 @@
virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
};
-typedef G1ParCopyClosure<false, G1BarrierNone, false> G1ParScanExtRootClosure;
-typedef G1ParCopyClosure<false, G1BarrierKlass, false> G1ParScanMetadataClosure;
+typedef G1ParCopyClosure<G1BarrierNone, false> G1ParScanExtRootClosure;
+typedef G1ParCopyClosure<G1BarrierKlass, false> G1ParScanMetadataClosure;
-typedef G1ParCopyClosure<false, G1BarrierNone, true> G1ParScanAndMarkExtRootClosure;
-typedef G1ParCopyClosure<true, G1BarrierNone, true> G1ParScanAndMarkClosure;
-typedef G1ParCopyClosure<false, G1BarrierKlass, true> G1ParScanAndMarkMetadataClosure;
-
-// The following closure types are no longer used but are retained
-// for historical reasons:
-// typedef G1ParCopyClosure<false, G1BarrierRS, false> G1ParScanHeapRSClosure;
-// typedef G1ParCopyClosure<false, G1BarrierRS, true> G1ParScanAndMarkHeapRSClosure;
+typedef G1ParCopyClosure<G1BarrierNone, true> G1ParScanAndMarkExtRootClosure;
+typedef G1ParCopyClosure<G1BarrierKlass, true> G1ParScanAndMarkMetadataClosure;
// The following closure type is defined in g1_specialized_oop_closures.hpp:
//
-// typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacClosure;
+// typedef G1ParCopyClosure<G1BarrierEvac, false> G1ParScanHeapEvacClosure;
// We use a separate closure to handle references during evacuation
// failure processing.
@@ -189,7 +183,7 @@
// (since that closure no longer assumes that the references it
// handles point into the collection set).
-typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure;
+typedef G1ParCopyClosure<G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure;
class FilterIntoCSClosure: public ExtendedOopClosure {
G1CollectedHeap* _g1;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp Mon Jan 20 11:47:29 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp Mon Jan 20 11:47:53 2014 +0100
@@ -33,18 +33,17 @@
// Forward declarations.
enum G1Barrier {
G1BarrierNone,
- G1BarrierRS,
G1BarrierEvac,
G1BarrierKlass
};
-template<bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
+template<G1Barrier barrier, bool do_mark_object>
class G1ParCopyClosure;
class G1ParScanClosure;
class G1ParPushHeapRSClosure;
-typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacClosure;
+typedef G1ParCopyClosure<G1BarrierEvac, false> G1ParScanHeapEvacClosure;
class FilterIntoCSClosure;
class FilterOutOfRegionClosure;