RFR: JDK-8304820: Statically allocate ObjectSynchronizer mutexes [v3]
Justin King
jcking at openjdk.org
Tue Mar 28 13:29:04 UTC 2023
On Tue, 28 Mar 2023 11:40:42 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> src/hotspot/share/runtime/synchronizer.cpp line 255:
>>
>>> 253: // by property of the storage itself being aligned to that requirement and each entry storage being
>>> 254: // `sizeof(PlatformMutex)` aligned up to `alignof(PlatformMutex)`.
>>> 255: alignas(PlatformMutex) static uint8_t _inflation_locks[inflation_lock_count()][align_up(sizeof(PlatformMutex), alignof(PlatformMutex))];
>>
>> I'm afraid you lost me here. Why does this have to be so convoluted/obscure?
>
> I thought `sizeof(T)` always was a multiple of `alignof(T)`. Is there some case where this is not true?
Ah, I had assumed it wasn't required. But a quick glance says it is. So I'll remove the `align_up`. Should be more simple now.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13160#discussion_r1150606641
More information about the hotspot-runtime-dev
mailing list