RFR: 8343177: JFR: Remove critical section for thread id assignment [v2]

David Holmes dholmes at openjdk.org
Thu Oct 31 04:54:29 UTC 2024


On Wed, 30 Oct 2024 11:34:43 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> src/hotspot/share/runtime/thread.hpp line 505:
>> 
>>> 503:   // Sets the argument thread as starting thread. Returns failure if thread
>>> 504:   // creation fails due to lack of memory, too many threads etc.
>>> 505:   static bool set_as_starting_thread(JavaThread* jt);
>> 
>> Why change this? Overall I don't understand the "starting thread" changes.
>
> I changed this with the argument that it is unbalanced to have a non-static instance function available on all Threads for calling t->set_as_starting_thread(), which should only be called on a JavaThread, to set a static field, a static field that is only set once, by the main (primordial) JavaThread during startup in Threads::create_VM().
> 
> The assert function is_starting_thread(Thread*t) is for asserting the special assignment of 1 to the primordial thread.

Okay so nothing inherently related to the critical section removal, just an API cleanup.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21756#discussion_r1823770005


More information about the hotspot-jfr-dev mailing list