8144701: Change three G1 remembererd set closures to be OopClosures

Reviewed-by: mgerdin, stefank
This commit is contained in:
Stefan Johansson 2015-12-11 17:49:41 +01:00
parent 79ddc15248
commit 33d3e19b81
3 changed files with 16 additions and 24 deletions

View File

@ -201,40 +201,40 @@ public:
// during an evacuation pause) to record cards containing
// pointers into the collection set.
class G1Mux2Closure : public ExtendedOopClosure {
class G1Mux2Closure : public OopClosure {
OopClosure* _c1;
OopClosure* _c2;
public:
G1Mux2Closure(OopClosure *c1, OopClosure *c2);
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); }
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); }
};
// A closure that returns true if it is actually applied
// to a reference
class G1TriggerClosure : public ExtendedOopClosure {
class G1TriggerClosure : public OopClosure {
bool _triggered;
public:
G1TriggerClosure();
bool triggered() const { return _triggered; }
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); }
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); }
};
// A closure which uses a triggering closure to determine
// whether to apply an oop closure.
class G1InvokeIfNotTriggeredClosure: public ExtendedOopClosure {
class G1InvokeIfNotTriggeredClosure: public OopClosure {
G1TriggerClosure* _trigger_cl;
OopClosure* _oop_cl;
public:
G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, 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); }
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 G1UpdateRSOrPushRefOopClosure: public OopClosure {

View File

@ -136,20 +136,20 @@ inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
}
template <class T>
inline void G1Mux2Closure::do_oop_nv(T* p) {
inline void G1Mux2Closure::do_oop_work(T* p) {
// Apply first closure; then apply the second.
_c1->do_oop(p);
_c2->do_oop(p);
}
template <class T>
inline void G1TriggerClosure::do_oop_nv(T* p) {
inline void G1TriggerClosure::do_oop_work(T* p) {
// Record that this closure was actually applied (triggered).
_triggered = true;
}
template <class T>
inline void G1InvokeIfNotTriggeredClosure::do_oop_nv(T* p) {
inline void G1InvokeIfNotTriggeredClosure::do_oop_work(T* p) {
if (!_trigger_cl->triggered()) {
_oop_cl->do_oop(p);
}

View File

@ -39,19 +39,11 @@ class FilterOutOfRegionClosure;
class G1CMOopClosure;
class G1RootRegionScanClosure;
// Specialized oop closures from g1RemSet.cpp
class G1Mux2Closure;
class G1TriggerClosure;
class G1InvokeIfNotTriggeredClosure;
#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f) \
f(G1ParScanClosure,_nv) \
f(G1ParPushHeapRSClosure,_nv) \
f(FilterOutOfRegionClosure,_nv) \
f(G1CMOopClosure,_nv) \
f(G1RootRegionScanClosure,_nv) \
f(G1Mux2Closure,_nv) \
f(G1TriggerClosure,_nv) \
f(G1InvokeIfNotTriggeredClosure,_nv)
f(G1RootRegionScanClosure,_nv)
#endif // SHARE_VM_GC_G1_G1_SPECIALIZED_OOP_CLOSURES_HPP