RFR: 8364235: Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory [v2]

David Holmes dholmes at openjdk.org
Wed Jul 30 06:16:59 UTC 2025


On Tue, 29 Jul 2025 08:27:46 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> That aligns the `GuardHeader` (something already done by `malloc`) but doesn't guarantee the alignment of the `_base_addr` field which is the user-data ptr.
>
> Forcing `alignas(16)` alignment on `GuardHeader` directly implies `sizeof(GuardHeader) % 16 == 0` without the need of a padding field. And C++ will be required to insert 8 byte padding after `_tag2`. 
> 
> If it is important that the padding occurs after the header and before the size keep the current solution.

I am surprised that `alignas` will pad in that way - I only expected it to align the initial placement. The docs do not seem to describe this, though the example implicitly does (as `sizeof(sse_t)` yields 32 not 16) [1]

I will test this out.

[1] http://en.cppreference.com/w/cpp/language/alignas.html

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26524#discussion_r2241630455


More information about the hotspot-runtime-dev mailing list