RFR: 8361912: ThreadsListHandle::cv_internal_thread_to_JavaThread does not deal with a virtual thread's carrier thread

Alex Menkov amenkov at openjdk.org
Mon Jul 21 22:10:24 UTC 2025


On Mon, 21 Jul 2025 21:43:02 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/runtime/threadSMR.hpp line 78:
>> 
>>> 76: // longer protected by a ThreadsListHandle.
>>> 77: //
>>> 78: // Note that for virtual threads, we obtain a reference to the carrier JavaThread
>> 
>> This is not correct for `JvmtiExport::cv_external_thread_to_JavaThread` (it does not return carrier's JavaThread).
>> JVMTI has `JvmtiEnvBase::get_threadOop_and_JavaThread` and `JvmtiEnvBase::get_JavaThread_or_null` to get carrier thread
>
> This code does not document/describe `JvmtiExport::cv_external_thread_to_JavaThread`.

This is common comment which describes 2 ways to get protected JavaThread, so to me it looks like it describes both (the rest of the comment is applicable to JvmtiExport::cv_external_thread_to_JavaThread).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26287#discussion_r2220457004


More information about the hotspot-dev mailing list