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

Justin King jcking at openjdk.org
Thu Mar 30 14:29:21 UTC 2023


On Thu, 30 Mar 2023 05:36:27 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> `alignas(PlatformMutex) static PlatformMutex _inflation_locks[inflation_lock_count()];` will not work as the compiler will use default initialization for the array, causing the constructor of PlatformMutex to be called during library loading by the dynamic linker.
>> 
>> With the current `uint8_t` usage, we have to ensure the compiler places the array at a suitable aligned boundary for `PlatformMutex` otherwise its free to place it at `alignas(uint8_t)` AFAIK, which can be 1.
>
> Ugghh sorry not thinking in C++ - forgot about the implicit initialization in that case.

That's okay, so did I originally.

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

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


More information about the hotspot-runtime-dev mailing list