RFR: 8365055: G1: Merge Heap Roots phase incorrectly clears young gen remembered set every time [v2]

Thomas Schatzl tschatzl at openjdk.org
Thu Aug 21 09:28:52 UTC 2025


On Mon, 18 Aug 2025 08:33:54 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   * fix comment in verification code
>>   * move that G1Policy member to G1CollectedHeap as it's used to verify stuff in G1CollectedHeap (and not used elsewhere anyway)
>
> src/hotspot/share/gc/g1/g1Policy.cpp line 933:
> 
>> 931: 
>> 932:     _analytics->report_pending_cards((double)pending_cards_at_gc_start(), is_young_only_pause);
>> 933:     _analytics->report_card_rs_length((double)_g1h->young_regions_cardset()->occupied(), is_young_only_pause);
> 
> At this point in the execution, the `_g1h->young_regions_cardset()->clear()` has already been called, so this will be `0`. 
> 
> `post_evacuate_collection_set()` calls `prepare_for_mutator_after_young_collection()`  which calls  `start_new_collection_set()`, but `post_evacuate_collection_set()` is called before `policy()->record_young_collection_end()`
> 
> Probably `_num_young_rem_set_cards_at_start` was added to `G1Policy`  to assert on this, but it is not used.

I forgot to remove `G1Policy::_num_young_rem_set_cards_at_start` in the latest change. The code uses the one in `G1CollectedHeap` now.

The other mentioned issue is true.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26695#discussion_r2290462309


More information about the hotspot-gc-dev mailing list