RFR: 8376568: Change Thread::getStackTrace to use handshake op for all cases [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Jan 29 17:55:57 UTC 2026


On Thu, 29 Jan 2026 04:21:18 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.cpp line 1944:
>> 
>>> 1942: 
>>> 1943:       bool is_virtual = java_lang_VirtualThread::is_instance(_thread_h());
>>> 1944:       bool vthread_carrier = !is_virtual && (java_thread != nullptr) && (java_thread->vthread_continuation() != nullptr);
>> 
>> The extra `java_thread != nullptr` should not be necessary.
>
> What would force it to be non-null? (Related: under what conditions will `th` be null and what does that imply about the value of `_thread_h()`?)

A null `java_thread` is only possible for the unmounted vthread case. The oop should always be a valid `java.lang.Thread` though. Maybe `thread_oop` should be initialized to `nullptr` and the assert at line 1914 be just `assert(thread_oop != nullptr, "Missing Thread oop");`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29461#discussion_r2742835509


More information about the core-libs-dev mailing list