RFR: JDK-8304820: Statically allocate ObjectSynchronizer mutexes [v3]

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Mar 28 11:43:33 UTC 2023


On Tue, 28 Mar 2023 05:04:37 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update approach to avoid implicit constructors
>>   
>>   Signed-off-by: Justin King <jcking at google.com>
>
> 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13160#discussion_r1150461135


More information about the hotspot-runtime-dev mailing list