RFR: 8351444: Shenandoah: Class Unloading may encounter recycled oops [v2]

William Kemper wkemper at openjdk.org
Mon Mar 10 21:25:07 UTC 2025


On Mon, 10 Mar 2025 18:55:51 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 two additional commits since the last revision:
> 
>  - Consider trash regions to be in the heap during concurrent weak roots
>  - Better comment for LRB when accessing unreachable oops

If it is just the name of the region state here, we could call it `pending_recycle` or something that communicates our intent to recycle it, but that we still need to use it. Moving `cset ` and `immediate trash` selection out of `final mark` would probably require a new safepoint. I think we would still need a means to express the 'region cannot be used for allocations' concept between final mark and class unloading.

I also modified `ShenandoahHeap::is_in` to match the same constraints we impose on the freeset for allocations during concurrent weak roots (https://github.com/openjdk/jdk/pull/23951/commits/a5db7360610691833ecb4204af2861c77c8b7858).

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

PR Comment: https://git.openjdk.org/jdk/pull/23951#issuecomment-2711869412


More information about the shenandoah-dev mailing list