On Mon, 14 Jul 2025 05:34:57 GMT, David Holmes <dhol...@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

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

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

Reply via email to