8257151: ZGC: Simplify ZVerify

Reviewed-by: pliden, eosterlund
This commit is contained in:
Stefan Karlsson 2020-11-26 13:02:49 +00:00
parent bf66d734bc
commit 0a5de50052
2 changed files with 29 additions and 31 deletions

View File

@ -252,6 +252,9 @@ public:
};
void ZVerify::roots_strong(bool verify_fixed) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
assert(!ZResurrection::is_blocked(), "Invalid phase");
ZVerifyRootClosure cl(verify_fixed);
ZVerifyCLDClosure cld_cl(&cl);
ZVerifyThreadClosure thread_cl(&cl);
@ -265,21 +268,12 @@ void ZVerify::roots_strong(bool verify_fixed) {
}
void ZVerify::roots_weak() {
ZVerifyRootClosure cl(true /* verify_fixed */);
ZWeakRootsIterator iter;
iter.apply(&cl);
}
void ZVerify::roots(bool verify_strong, bool verify_weaks) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
assert(!ZResurrection::is_blocked(), "Invalid phase");
if (ZVerifyRoots) {
roots_strong(verify_strong);
if (verify_weaks) {
roots_weak();
}
}
ZVerifyRootClosure cl(true /* verify_fixed */);
ZWeakRootsIterator iter;
iter.apply(&cl);
}
void ZVerify::objects(bool verify_weaks) {
@ -287,34 +281,40 @@ void ZVerify::objects(bool verify_weaks) {
assert(ZGlobalPhase == ZPhaseMarkCompleted, "Invalid phase");
assert(!ZResurrection::is_blocked(), "Invalid phase");
if (ZVerifyObjects) {
ZVerifyOopClosure cl(verify_weaks);
ObjectToOopClosure object_cl(&cl);
ZHeap::heap()->object_iterate(&object_cl, verify_weaks);
}
}
void ZVerify::roots_and_objects(bool verify_strong, bool verify_weaks) {
roots(verify_strong, verify_weaks);
objects(verify_weaks);
ZVerifyOopClosure cl(verify_weaks);
ObjectToOopClosure object_cl(&cl);
ZHeap::heap()->object_iterate(&object_cl, verify_weaks);
}
void ZVerify::before_zoperation() {
// Verify strong roots
ZStatTimerDisable disable;
roots(false /* verify_strong */, false /* verify_weaks */);
if (ZVerifyRoots) {
roots_strong(false /* verify_fixed */);
}
}
void ZVerify::after_mark() {
// Verify all strong roots and strong references
ZStatTimerDisable disable;
roots_and_objects(true /* verify_strong */, false /* verify_weaks */);
if (ZVerifyRoots) {
roots_strong(true /* verify_fixed */);
}
if (ZVerifyObjects) {
objects(false /* verify_weaks */);
}
}
void ZVerify::after_weak_processing() {
// Verify all roots and all references
ZStatTimerDisable disable;
roots_and_objects(true /* verify_strong */, true /* verify_weaks */);
if (ZVerifyRoots) {
roots_strong(true /* verify_fixed */);
roots_weak();
}
if (ZVerifyObjects) {
objects(true /* verify_weaks */);
}
}
template <bool Map>
@ -379,10 +379,10 @@ class StackWatermarkProcessingMark {
public:
StackWatermarkProcessingMark(Thread* thread) :
_rnhm(),
_hm(thread),
_pem(thread),
_rm(thread) { }
_rnhm(),
_hm(thread),
_pem(thread),
_rm(thread) {}
};
void ZVerify::verify_frame_bad(const frame& fr, RegisterMap& register_map) {

View File

@ -34,9 +34,7 @@ private:
static void roots_strong(bool verify_fixed);
static void roots_weak();
static void roots(bool verify_strong, bool verify_weaks);
static void objects(bool verify_weaks);
static void roots_and_objects(bool verify_strong, bool verify_weaks);
public:
static void before_zoperation();