On Mon, 21 Jul 2025 18:42:14 GMT, Alex Menkov <amen...@openjdk.org> wrote:
>> The `cv_internal_thread_to_JavaThread` method will now check if the thread >> is a mounted virtual thread, and if so protect the carrier thread. User's of >> the API that need to deal with virtual threads must still check the carrier >> themselves as it could change asynchronously, but it is now guaranteed that >> the carrier JavaThread returned via this method cannot terminate whilst >> being used (the same as regular platform JavaThreads). >> >> It was noticed whilst updating the documentation that the `JvmtiExport` >> variant `cv_oop_to_JavaThread` is unused and so can be removed. >> >> Testing: >> - tiers 1-4 >> >> Thanks > > 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`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26287#discussion_r2220422664