RFR: 8280375: G1: Tighten mem region limit in G1RebuildRemSetHeapRegionClosure

Hamlin Li mli at openjdk.java.net
Fri Jan 21 09:20:51 UTC 2022


On Thu, 20 Jan 2022 10:15:11 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Currently, it uses `hr->end()` to guard the mem scan limit, but it should be top instead of end.
>
> src/hotspot/share/gc/g1/g1RemSet.cpp line 1960:
> 
>> 1958: 
>> 1959:       HeapWord* cur = hr->bottom();
>> 1960:       while (cur < hr->top()) {
> 
> I think it is possible (and less misleading) to just use a `while (true) {` loop. Neither a condition containing `end()` or `top()` is correct. The only boundary that matters is `top_at_rebuild_start()`; since it can change between iterations, and it is needed in the loop I do not see a good condition here.
> (Using `top()` may exit the loop just a tiny bit earlier than the `next_chunk.is_empty()` check below though, but for simplicity, i.e. having one exit condition less to think about, it might be useful to just state `true` here).

Agree, will upate the patch.

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

PR: https://git.openjdk.java.net/jdk/pull/7154



More information about the hotspot-gc-dev mailing list