RFR: JDK-8304723: Statically allocate global mutexes [v4]

Justin King jcking at openjdk.org
Thu Mar 23 15:20:24 UTC 2023


On Thu, 23 Mar 2023 15:13:12 GMT, Justin King <jcking at openjdk.org> wrote:

>> Switch to statically allocate storage for all of Hotspot's global mutexes and monitors. This avoids needing to allocate each one dynamically at startup. These also live for the lifetime of the program, so this reduces any potential memory fragmention in the C heap.
>
> Justin King has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update indentation
>   
>   Signed-off-by: Justin King <jcking at google.com>

Okay, updated to do the minimally invasive approach. Storage for the mutex/monitors is in a static variable in mutexLocker.cpp. They now `assert` that they are not creating the same mutex/monitor twice, fixing the `Heap_lock` issue. I also consolidated the macro definitions and fixed some padding. Lastly I removed the dual declaration of `tty_lock`.

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

PR Comment: https://git.openjdk.org/jdk/pull/13143#issuecomment-1481384319


More information about the hotspot-dev mailing list