RFR: 8282721: HotSpot Style Guide should allow considered use of C++ thread_local [v2]

David Holmes dholmes at openjdk.java.net
Thu Mar 10 01:31:14 UTC 2022


On Wed, 9 Mar 2022 20:09:57 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> First, it's not exactly a new sentence, just one moved from elsewhere in our code base (from a file that was deleted in the companion PR to this one).
>> 
>> Second, it is true; we have seen problems in the (distant) past of exactly the form claimed.  The problem is that HotSpot is an irregular user of C++, including via assembly code and tortuous stack frame manipulation (deopt handlers etc.).  It's easy to accidentally emit a use of of global `op new` through ten layers of C++ header file, and in HotSpot it's also easy to break the careful matching of constructors to destructors that C++ relies on.  The result is a storage leak.
>> 
>> Kim, I could see you thinking, also, that this sort of observation doesn't belong in a style guide, and a lot of these nuggets might tend to bloat which obscures the useful parts of the style guide.  (An over-long guide is not a useful guide after all.)  You might suggest where this rationale information goes, if not here.  But I think it fits well enough here.  And if it isn't inserted here, or some other new place, it will be lost because of David's file deletion in the other PR related to this one.  I don't want it to get lost.
>
> If that sentence (or something like it) were at the end of the following "rationale" paragraph (where I think @rose00 originally suggested) then I'd be okay with it, as that would put it in the scope of the NMT requirement.  Maybe even remove "typically" in that location.

Moved to the rationale as suggested.

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

PR: https://git.openjdk.java.net/jdk/pull/7720


More information about the hotspot-dev mailing list