RFR: 8356173: Remove ThreadCritical [v3]
Coleen Phillimore
coleenp at openjdk.org
Mon May 12 12:07:54 UTC 2025
On Sat, 10 May 2025 03:21:13 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> I'm not really sold on what the purpose of Deferred is tbh. Seems like it would add some more boilerplate since I the initialization function is only one obvious line.
>
> The initialization lines are similar one-liners.
> Deferred<> access already had the initialized check built-in, so don't need the explicit assert.
> Deferred<> avoids the pointer indirection.
> Deferred<> avoids dynamic allocation.
I still fail to see the point of this. dynamic allocation isn't something that's a problem for this object. It may be for the NMT types that use this wrapper but not for this object. You cannot write a microbenchmark to show the effect of this pointer indirection in this code path. If you could, there's something seriously wrong with our algorithms which should be fixed instead. The initialization check is an obvious one liner, not executable in production.
The DeferredWhat? wrapper is extra typing, that requires you to go to some other place to figure out that among all the casting, it's doing a placement new. For no reason other than to give you more code to navigate to.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25072#discussion_r2084527418
More information about the hotspot-dev
mailing list