RFR: 8366154: Validate thread type requirements in debug commands [v2]
Kerem Kat
krk at openjdk.org
Tue Sep 9 17:19:26 UTC 2025
On Tue, 9 Sep 2025 15:31:30 GMT, Volker Simonis <simonis at openjdk.org> wrote:
>> Kerem Kat has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - add include for global placement new
>> - remove onJavaThread and check JavaThread::active null where needed
>
> src/hotspot/share/utilities/debug.cpp line 305:
>
>> 303: // ResourceMark is only created if a Thread or a JavaThread is required,
>> 304: // and we are actually on a Thread.
>> 305: union { ResourceMark _rm; };
>
> The semantics of `union { ResourceMark _rm; }` was not familiar to me and it took me some time to find it in the specification. Maybe make this more obvious by refining the comment to something like:
>
>
> // Union members of class type are implicitly allocated but not constructed automatically.
> // We therefor have to explicitly construct '_rm' with a placement new call (see 'onThread()') and
> // clean it up afterwards with an explicit destructor call (see '~Command()').
Thank you, updated.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2334269045
More information about the hotspot-dev
mailing list