RFR: 8346572: Check is_reserved() before using ReservedSpace instances

Y. Srinivas Ramakrishna ysr at openjdk.org
Thu Jan 16 16:44:39 UTC 2025


On Thu, 19 Dec 2024 09:35:33 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> There are a number of places where we reserve memory and create a ReservedSpace, and after the use the created instance without checking if the memory actually got reserved and the instance got initialized. This mostly affects code paths during JVM initialization and fixing this will mostly give better error handling and tracing.
> 
> The patch also includes some minor restructuring to get early returns and remove redundant null checks after calls to new.
> 
> Tested tier1 and GHA, but will run more tests when/if this gets accepted.

The changes look fine to me.

We probably want to clean up Shenandoah code related to failure to reserve space in a separate ticket. Thanks for bringing these changes to our attention; I had missed the original refactoring of address range reservations that you had started before the holidays.

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 391:

> 389: 
> 390:       // Maybe Shenandoah wants to check the the memory got reserved here?
> 391: 

Thanks for tagging us Stefan. There seem to be a few places where we might want to check & guard for failure to reserve the space. It might make sense to clean up these failure paths in a separate ticket. cc @earthling-amzn @shipilev ?

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

Marked as reviewed by ysr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22825#pullrequestreview-2556672862
PR Review Comment: https://git.openjdk.org/jdk/pull/22825#discussion_r1918859248


More information about the hotspot-gc-dev mailing list