RFR: 8351444: Shenandoah: Class Unloading may encounter recycled oops [v3]
Aleksey Shipilev
shade at openjdk.org
Tue Mar 11 16:03:07 UTC 2025
On Mon, 10 Mar 2025 21:25:06 GMT, William Kemper <wkemper at openjdk.org> wrote:
>> Unloading classes may require a walk of unreachable oops. For this reason, it is not safe to recycle memory before class unloading is complete. This complements existing code to prevent mutators from recycling trash regions while weak roots is in progress.
>
> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
>
> Trim extraneous comment
Looks okay to me. @rkennke, @zhengyu123 might have an opinion here as well.
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 844:
> 842: // during weak roots. Concurrent class unloading may access unmarked oops
> 843: // in trash regions.
> 844: return r->is_trash() && is_concurrent_weak_root_in_progress();
Pity to do this, but I understand the reason for it.
We should investigate if this window is unnecessarily large. I see currently we drop `WEAK_ROOTS` gc state in `ShenandoahHeap::concurrent_prepare_for_update_refs`. Should we drop the flag sooner, somewhere after concurrent class unloading? Can be done separately, if it snowballs into something more complicated.
-------------
Marked as reviewed by shade (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/23951#pullrequestreview-2675209101
PR Review Comment: https://git.openjdk.org/jdk/pull/23951#discussion_r1989630728
More information about the shenandoah-dev
mailing list