Skip to content

Commit

Permalink
8329764: G1: Handle null references during verification first
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, iwalulya
  • Loading branch information
Thomas Schatzl committed Apr 15, 2024
1 parent 60d88b7 commit a3fecdb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hotspot/share/gc/g1/g1HeapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,18 @@ class G1VerifyLiveAndRemSetClosure : public BasicOopIterateClosure {

template <class T>
void do_oop_work(T* p) {
if (_failures->count() >= G1MaxVerifyFailures) {
// 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;
}

T heap_oop = RawAccess<>::oop_load(p);
if (CompressedOops::is_null(heap_oop)) {
if (_failures->count() >= G1MaxVerifyFailures) {
return;
}

oop obj = CompressedOops::decode_raw_not_null(heap_oop);

LiveChecker<T> live_check(_failures, _containing_obj, p, obj, _vo);
Expand Down

1 comment on commit a3fecdb

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.