RFR: 8342848: Shenandoah: Marking bitmap may not be completely cleared in generational mode

Xiaolong Peng xpeng at openjdk.org
Wed Oct 23 18:54:28 UTC 2024


On Wed, 23 Oct 2024 18:11:30 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp line 80:
>> 
>>> 78:     ShenandoahMarkingContext* const ctx = heap->marking_context();
>>> 79:     while (region != nullptr) {
>>> 80:       bool needs_reset = !region->is_affiliated() || _generation->contains(region);
>> 
>> We should really read the affiliation only once for the whole test, but will have to create a new method to achieve that to keep the code clean and encapsulated.
>
> Hmm, you reckon the affiliation is changing between first testing for `_generation->contains` and then testing for `!region->is_affiliated()`? I suppose this _could_ happen, but the fix feels fragile (not sure we can guarantee the compiler won't reorder the tests). We do have `ShenandoahHeapRegion::affiliation`. What about:
> 
>   auto affiliation = region->affiliation();
>   bool needs_reset = (affiliation == ShenandoahAffiliation::FREE || _generation->contains(affiliation))
> 
> Where `ShenandoahGeneration::contains(ShenandoaAffiliation affiliation)` tests if the affiliation and the generation type match?

I didn't notice we have `ShenandoahGeneration::contains(ShenandoaAffiliation affiliation) `, I'll update the PR, thanks.

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

PR Review Comment: https://git.openjdk.org/shenandoah/pull/523#discussion_r1813364499


More information about the shenandoah-dev mailing list