RFR: 8329570: G1: Excessive is_obj_dead_cond calls in verification

Aleksey Shipilev shade at openjdk.org
Wed Apr 3 11:18:09 UTC 2024


On Wed, 3 Apr 2024 11:12:25 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1HeapRegion.cpp line 627:
>> 
>>> 625:   void set_containing_obj(oop const obj) {
>>> 626:     assert(!G1CollectedHeap::heap()->is_obj_dead_cond(obj, _vo), "Precondition");
>>> 627:     _containing_obj = obj;
>> 
>> Should the method `set_containing_obj` judge whether the `obj` is `null`? Just like the `do_oop_work`.
>
> Sounds like a reasonable thing to do. I'll move that assert as well.

You mean moving `assert(_containing_obj != nullptr, "must be");` from `do_oop_work`? I think it should stay there, as it verifies that someone called `set_containing_obj` before doing `do_oop_work`?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18595#discussion_r1549510151


More information about the hotspot-gc-dev mailing list