RFR: 8364235: Fix for JDK-8361447 breaks the alignment requirements for GuardedMemory [v4]
Andrew Dinn
adinn at openjdk.org
Wed Jul 30 15:26:55 UTC 2025
On Wed, 30 Jul 2025 06:13:51 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> 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
I would assume it has to do so in order to ensure arrays of objects all stay aligned.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26524#discussion_r2243078469
More information about the hotspot-runtime-dev
mailing list