diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 87b0cf25e9f..adf7823cb0c 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -76,18 +76,10 @@ bool DefNewGeneration::IsAliveClosure::do_object_b(oop p) { return cast_from_oop(p) >= _young_gen->reserved().end() || p->is_forwarded(); } -DefNewGeneration::KeepAliveClosure:: -KeepAliveClosure(ScanWeakRefClosure* cl) : _cl(cl) { - _rs = GenCollectedHeap::heap()->rem_set(); -} - -void DefNewGeneration::KeepAliveClosure::do_oop(oop* p) { DefNewGeneration::KeepAliveClosure::do_oop_work(p); } -void DefNewGeneration::KeepAliveClosure::do_oop(narrowOop* p) { DefNewGeneration::KeepAliveClosure::do_oop_work(p); } - - DefNewGeneration::FastKeepAliveClosure:: FastKeepAliveClosure(DefNewGeneration* g, ScanWeakRefClosure* cl) : - DefNewGeneration::KeepAliveClosure(cl) { + _cl(cl) { + _rs = GenCollectedHeap::heap()->rem_set(); _boundary = g->reserved().end(); } diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index 1a448c5fd23..33328266fa4 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -167,19 +167,9 @@ protected: bool do_object_b(oop p); }; - class KeepAliveClosure: public OopClosure { - protected: + class FastKeepAliveClosure: public OopClosure { ScanWeakRefClosure* _cl; CardTableRS* _rs; - template void do_oop_work(T* p); - public: - KeepAliveClosure(ScanWeakRefClosure* cl); - virtual void do_oop(oop* p); - virtual void do_oop(narrowOop* p); - }; - - class FastKeepAliveClosure: public KeepAliveClosure { - protected: HeapWord* _boundary; template void do_oop_work(T* p); public: diff --git a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp b/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp index c1742739f92..23582cc6e18 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.inline.hpp @@ -36,37 +36,6 @@ // Methods of protected closure types -template -inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) { -#ifdef ASSERT - { - // We never expect to see a null reference being processed - // as a weak reference. - oop obj = RawAccess::oop_load(p); - assert (oopDesc::is_oop(obj), "expected an oop while scanning weak refs"); - } -#endif // ASSERT - - Devirtualizer::do_oop(_cl, p); - - // Card marking is trickier for weak refs. - // This oop is a 'next' field which was filled in while we - // were discovering weak references. While we might not need - // to take a special action to keep this reference alive, we - // will need to dirty a card as the field was modified. - // - // Alternatively, we could create a method which iterates through - // each generation, allowing them in turn to examine the modified - // field. - // - // We could check that p is also in the old generation, but - // dirty cards in the young gen are never scanned, so the - // extra check probably isn't worthwhile. - if (GenCollectedHeap::heap()->is_in_reserved(p)) { - _rs->inline_write_ref_field_gc(p); - } -} - template inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) { #ifdef ASSERT