RFR: 8237363 remove oop iterate verification
Stefan Karlsson
stefank at openjdk.java.net
Thu Oct 22 07:35:21 UTC 2020
There's verification code in the "oop iterate" framework that asserts that a pointer is "is in the heap". This works for most GCs, but ZGC *can* eagerly decommit the old relocation set pages, which means that pointers to the old / from copy of the object could point to memory that is currently not a part of the current heap.
To combat this in the past I've added a way for oop iterate closures to turn off this verification. However, every single time we add a new closure we have to consider if we can allow this verification check or if we have to remove it. Personally, I think this is a false abstraction and also widens the oop iterate closure interface. I previously proposed a patch that moved the verification code down into the oop iterate closures. It wasn't a huge patch, but I got push-back that it was convenient for other GCs to get this automatic verification, and the review stalled.
In this new patch I propose a different way to retain the verification. The realization is that most oop iterate closures have to deal with both compressed and non-compressed oops, so the code typically looks like this:
template <class T>
inline void G1ScanCardClosure::do_oop_work(T* p) {
T o = RawAccess<>::oop_load(p);
if (CompressedOops::is_null(o)) {
return;
}
oop obj = CompressedOops::decode_not_null(o);
Therefore the suggest new place to put the is_in verification is in the CompressedOops::decode*. This injects the assert into almost all non-ZGC closures, and also to places that don't use the oop iterate closure framework. I think this is a neat workaround, and hope this patch is accepted this time.
I've tested this patch a few weeks ago, but will rerun the relevant tiers.
-------------
Commit messages:
- Remove assert macros
- Merge branch 'master' into 8237363_remove_oop_iterate_verification
- Merge branch 'master' into 8237363_remove_oop_iterate_verification
- 8237363: Remove automatic is in heap verification in OopIterateClosure
Changes: https://git.openjdk.java.net/jdk/pull/797/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=797&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8237363
Stats: 117 lines in 17 files changed: 25 ins; 83 del; 9 mod
Patch: https://git.openjdk.java.net/jdk/pull/797.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/797/head:pull/797
PR: https://git.openjdk.java.net/jdk/pull/797
More information about the hotspot-dev
mailing list