RFR: JDK-8304723: Statically allocate global mutexes
Justin King
jcking at openjdk.org
Thu Mar 23 14:40:03 UTC 2023
On Thu, 23 Mar 2023 06:34:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> I'd be very happy if startup would be fast enough for ~150 fewer mallocs to matter.
>
> A blank hello world with no args to speak of calls into malloc >10k times. ~150(?) mallocs less are a step in the right direction.
Baby steps. :)
As a compromise I'll shift to keeping the pointers and just use a static storage variable in the `def` macros, as suggested. It accomplishes the goal if not malloc'ing but is not as safe due to the two aforementioned bugs. I'll also add an assert to catch the "created twice" problem. But having the mutex pointer always be nullptr is a different story that cannot be caught with that approach.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13143#issuecomment-1481313074
More information about the hotspot-dev
mailing list