RFR: 8351137: ZGC: Improve ZValueStorage alignment support

Joel Sikström jsikstro at openjdk.org
Wed Mar 5 19:51:58 UTC 2025


On Tue, 4 Mar 2025 08:34:36 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> ZValueStorage only align the allocations to the alignment defined by the storage but ignores the alignment of the types. Right now all usages of our different storages all have types which have an alignment less than or equal to the alignment set by its storage.
> 
> I wish to improve this so that types with greater alignment than the storage alignment can be used.
> 
> The UB caused by using a type larger than the storage alignment is something I have seen materialise as returning bad address (and crashing) on Windows.
> 
> As we use `utilities/align.hpp` for our alignment utilities we only support power of two alignment, I added extra asserts here because we use the fact that `lcm(x, y) = max(x, y)` if both are powers of two. 
> 
> Testing:
>   * tier 1 through tier 5 Oracle supported platforms
>   * GHA

Marked as reviewed by jsikstro (Committer).

Looks very good!

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

PR Review: https://git.openjdk.org/jdk/pull/23887#pullrequestreview-2662333450
PR Comment: https://git.openjdk.org/jdk/pull/23887#issuecomment-2701914039


More information about the hotspot-gc-dev mailing list