RFR: 8356173: Remove ThreadCritical
Johan Sjölen
jsjolen at openjdk.org
Fri May 9 12:59:51 UTC 2025
On Fri, 9 May 2025 06:16:31 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/memory/arena.cpp line 47:
>>
>>> 45: void Arena::initialize_chunk_pool() {
>>> 46: _global_chunk_pool_mutex = new PlatformMutex();
>>> 47: }
>>
>> Possibly a candidate for @jdksjolen 's `Deferred<T>`?
>
> Why do we even need dynamic initialization here? I thought that is the tradeoff with PlatformMutex: you forego deadlock checks etc, but you gain safety wrt initialisation.
> That would also save some instructions.
You can use `Deferred<T>`, but as `PlatformMutex` is at "the bottom" of the initialization order it's not necessary, as Thomas notes. I'd be happy to see it use `Deferred<T>`, as it can help with debugging if PlatformMutex ever changes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25072#discussion_r2081615044
More information about the hotspot-dev
mailing list