8329764: G1: Handle null references during verification first

Reviewed-by: stefank, iwalulya
This commit is contained in:
Thomas Schatzl 2024-04-15 13:21:18 +00:00
parent 60d88b7ae2
commit a3fecdb2f4

View File

@ -621,14 +621,18 @@ class G1VerifyLiveAndRemSetClosure : public BasicOopIterateClosure {
template <class T>
void do_oop_work(T* p) {
if (_failures->count() >= G1MaxVerifyFailures) {
return;
}
// Check for null references first - they are fairly common and since there is
// nothing to do for them anyway (they can't fail verification), it makes sense
// to handle them first.
T heap_oop = RawAccess<>::oop_load(p);
if (CompressedOops::is_null(heap_oop)) {
return;
}
if (_failures->count() >= G1MaxVerifyFailures) {
return;
}
oop obj = CompressedOops::decode_raw_not_null(heap_oop);
LiveChecker<T> live_check(_failures, _containing_obj, p, obj, _vo);