< prev index next >
src/share/vm/gc/g1/g1OopClosures.hpp
Print this page
rev 12513 : 8071278: Fix the closure mess in G1RemSet::refine_card()
Summary: Remove the use of many nested closure in the code to refine a card.
Reviewed-by: kbarrett, sjohanss
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -141,33 +141,10 @@
G1KlassScanClosure(G1ParCopyHelper* closure, bool process_only_dirty)
: _process_only_dirty(process_only_dirty), _closure(closure), _count(0) {}
void do_klass(Klass* klass);
};
-class FilterIntoCSClosure: public OopClosure {
- G1CollectedHeap* _g1;
- OopClosure* _oc;
-public:
- FilterIntoCSClosure(G1CollectedHeap* g1, OopClosure* oc) : _g1(g1), _oc(oc) { }
-
- template <class T> void do_oop_work(T* p);
- virtual void do_oop(oop* p) { do_oop_work(p); }
- virtual void do_oop(narrowOop* p) { do_oop_work(p); }
-};
-
-class FilterOutOfRegionClosure: public ExtendedOopClosure {
- HeapWord* _r_bottom;
- HeapWord* _r_end;
- OopClosure* _oc;
-public:
- FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc);
- template <class T> void do_oop_nv(T* p);
- virtual void do_oop(oop* p) { do_oop_nv(p); }
- virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
- bool apply_to_weak_ref_discovered_field() { return true; }
-};
-
// Closure for iterating over object fields during concurrent marking
class G1CMOopClosure : public MetadataAwareOopClosure {
protected:
G1ConcurrentMark* _cm;
private:
@@ -191,78 +168,40 @@
template <class T> void do_oop_nv(T* p);
virtual void do_oop( oop* p) { do_oop_nv(p); }
virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
};
-// Closure that applies the given two closures in sequence.
-// Used by the RSet refinement code (when updating RSets
-// during an evacuation pause) to record cards containing
-// pointers into the collection set.
-
-class G1Mux2Closure : public OopClosure {
- OopClosure* _c1;
- OopClosure* _c2;
-public:
- G1Mux2Closure(OopClosure *c1, OopClosure *c2);
- template <class T> inline void do_oop_work(T* p);
- virtual inline void do_oop(oop* p);
- virtual inline void do_oop(narrowOop* p);
-};
-
-// A closure that returns true if it is actually applied
-// to a reference
-
-class G1TriggerClosure : public OopClosure {
- bool _triggered;
-public:
- G1TriggerClosure();
- bool triggered() const { return _triggered; }
- template <class T> inline void do_oop_work(T* p);
- virtual inline void do_oop(oop* p);
- virtual inline void do_oop(narrowOop* p);
-};
-
-// A closure which uses a triggering closure to determine
-// whether to apply an oop closure.
-
-class G1InvokeIfNotTriggeredClosure: public OopClosure {
- G1TriggerClosure* _trigger_cl;
- OopClosure* _oop_cl;
-public:
- G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc);
- template <class T> inline void do_oop_work(T* p);
- virtual inline void do_oop(oop* p);
- virtual inline void do_oop(narrowOop* p);
-};
-
-class G1UpdateRSOrPushRefOopClosure: public OopClosure {
+class G1UpdateRSOrPushRefOopClosure: public ExtendedOopClosure {
G1CollectedHeap* _g1;
- G1RemSet* _g1_rem_set;
HeapRegion* _from;
G1ParPushHeapRSClosure* _push_ref_cl;
bool _record_refs_into_cset;
uint _worker_i;
+ bool _has_refs_into_cset;
public:
G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
- G1RemSet* rs,
G1ParPushHeapRSClosure* push_ref_cl,
bool record_refs_into_cset,
uint worker_i = 0);
void set_from(HeapRegion* from) {
assert(from != NULL, "from region must be non-NULL");
_from = from;
}
+ bool apply_to_weak_ref_discovered_field() { return true; }
+
bool self_forwarded(oop obj) {
markOop m = obj->mark();
bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
return result;
}
- template <class T> inline void do_oop_work(T* p);
+ bool has_refs_into_cset() const { return _has_refs_into_cset; }
+
+ template <class T> inline void do_oop_nv(T* p);
virtual inline void do_oop(narrowOop* p);
virtual inline void do_oop(oop* p);
};
#endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
< prev index next >