8200362: G1Mux2Closure should disable implicit oop verification
Summary: To avoid the implicit oop verification provided by OopClosure and oop_iterate_no_header, let G1 verification closures inherit from ExtendedOopClosures and disable this verification.
Reviewed-by: stefank, sjohanss
--- a/src/hotspot/share/gc/g1/heapRegion.cpp Thu Mar 29 15:05:31 2018 +0200
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp Thu Mar 29 17:15:26 2018 +0200
@@ -450,7 +450,7 @@
p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start()), rem_set()->get_state_str());
}
-class G1VerificationClosure : public OopClosure {
+class G1VerificationClosure : public ExtendedOopClosure {
protected:
G1CollectedHeap* _g1h;
G1CardTable *_ct;
@@ -483,6 +483,9 @@
obj->print_on(out);
#endif // PRODUCT
}
+
+ // This closure provides its own oop verification code.
+ debug_only(virtual bool should_verify_oops() { return false; })
};
class VerifyLiveClosure : public G1VerificationClosure {
@@ -605,7 +608,7 @@
};
// Closure that applies the given two closures in sequence.
-class G1Mux2Closure : public OopClosure {
+class G1Mux2Closure : public ExtendedOopClosure {
OopClosure* _c1;
OopClosure* _c2;
public:
@@ -617,6 +620,9 @@
}
virtual inline void do_oop(oop* p) { do_oop_work(p); }
virtual inline void do_oop(narrowOop* p) { do_oop_work(p); }
+
+ // This closure provides its own oop verification code.
+ debug_only(virtual bool should_verify_oops() { return false; })
};
// This really ought to be commoned up into OffsetTableContigSpace somehow.
@@ -657,7 +663,7 @@
// verify liveness and rem_set
vr_cl.set_containing_obj(obj);
G1Mux2Closure mux(&vl_cl, &vr_cl);
- obj->oop_iterate_no_header(&mux);
+ obj->oop_iterate(&mux);
if (vr_cl.failures()) {
*failures = true;
@@ -668,7 +674,7 @@
}
} else {
// verify only liveness
- obj->oop_iterate_no_header(&vl_cl);
+ obj->oop_iterate(&vl_cl);
}
if (vl_cl.failures()) {
*failures = true;
@@ -784,7 +790,7 @@
if (!g1->is_obj_dead_cond(obj, this, vo)) {
if (oopDesc::is_oop(obj)) {
vr_cl.set_containing_obj(obj);
- obj->oop_iterate_no_header(&vr_cl);
+ obj->oop_iterate(&vr_cl);
if (vr_cl.failures()) {
*failures = true;