On Tue, 28 Oct 2025 10:44:58 GMT, David Holmes <[email protected]> wrote:

>> We have loads of JavaThreads that don't run Java code (e.g. service thread, 
>> compiler threads, string dedup thread, monitor deflation thread). The window 
>> of time in which it lacks a Thread object, is before we start executing Java 
>> byte codes at all. But like those other threads I mentioned, it does not 
>> have any business executing Java code, despite being a JavaThread. It is a 
>> JavaThread because I want it to have a TLAB so it can efficiently allocate 
>> objects in the heap.
>
> Sorry I should have said "run Java code and/or interact with oops" - though 
> even that may be incomplete. Okay point taken though the others still get 
> their Thread oop before they start. Having a new "JavaThread" running around 
> before even the main thread is fully attached may surprise some code.

The main thread still attaches first. The main thread, like this new AOT 
thread, attaches before it has a thread oop. They both have their thread oops 
created inside of Threads::initialize_java_lang_classes after the Thread class 
has been initialized.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27732#discussion_r2470178073

Reply via email to