RFR: 8279910: G1: Simplify HeapRegionRemSet::add_reference
Hamlin Li
mli at openjdk.java.net
Mon Jan 17 14:36:27 UTC 2022
On Fri, 14 Jan 2022 14:43:50 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> HeapRegionRemSet::add_reference checks "state == Untracked" and return if true; it's called at G1RebuildRemSetClosure::do_oop_work and G1ConcurrentRefineOopClosure::do_oop_work respectively.
>>
>> The check in HeapRegionRemSet::add_reference could be replaced with an assert, and move the check up to one of the caller G1RebuildRemSetClosure::do_oop_work.
>
> src/hotspot/share/gc/g1/heapRegionRemSet.inline.hpp line 126:
>
>> 124:
>> 125: void HeapRegionRemSet::add_reference(OopOrNarrowOopStar from, uint tid) {
>> 126: assert(_state != Untracked, "must be");
>
> I would prefer "precondition" in the assert msg.
Thanks Albert for the suggestion, I kinda agree.
But as the nearby code at line 122 uses "must be", so I will keep it for this case.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7045
More information about the hotspot-gc-dev
mailing list