RFR: 8369631: Assess and remedy any unsafe usage of the sr_semaphore Semaphore in the Posix signal code
Kim Barrett
kbarrett at openjdk.org
Wed Oct 15 00:58:08 UTC 2025
On Wed, 15 Oct 2025 00:54:36 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Thanks for taking a look @kimbarrett . I expected someone would say "why not switch both to DeferredStatic?" and I don't have an issue doing that (missing init checks notwithstanding), but it wasn't my immediate goto because I don't see `DeferredStatic as really being any superior to declaring a pointer instead (which is how we do lazy initialization in 99.9% of the VM).
>
> DeferredStatic avoids the memory allocation for initialization, and removes a
> memory dereference when using.
>
> We use pointers at least in part because the technology on which
> DeferredStatic is based requires C++11 (which we've not been using for all
> that long). And it took a while for someone to get sufficiently annoyed with
> the pointer idiom to try to do better.
I won't block the change as-is if you really don't want to do DeferredStatic, but I think you should.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27762#discussion_r2430852385
More information about the hotspot-runtime-dev
mailing list