From 2fe0bf66b7cbbae3dc65249be4b04f4075a98efa Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Tue, 15 Feb 2022 16:22:37 +0000 Subject: [PATCH] 8281748: runtime/logging/RedefineClasses.java failed "assert(addr != __null) failed: invariant" Reviewed-by: ayang, kbarrett --- src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index c78a7203f15..73575e0f532 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -41,8 +41,14 @@ #include "utilities/bitMap.inline.hpp" inline bool G1CMIsAliveClosure::do_object_b(oop obj) { - HeapRegion* hr = _g1h->heap_region_containing(cast_from_oop(obj)); + // Check whether the passed in object is null. During discovery the referent + // may be cleared between the initial check and being passed in here. + if (obj == NULL) { + // Return true to avoid discovery when the referent is NULL. + return true; + } + HeapRegion* hr = _g1h->heap_region_containing(cast_from_oop(obj)); // All objects allocated since the start of marking are considered live. if (hr->obj_allocated_since_next_marking(obj)) { return true;