From 8d7f42617376088bc2becfc3e63a2e95d7a4baef Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Wed, 18 Feb 2026 11:12:02 -0800 Subject: [PATCH] review: moved comment clarifying _thread from its init to definition --- src/hotspot/share/prims/jvmtiThreadState.cpp | 7 +------ src/hotspot/share/prims/jvmtiThreadState.hpp | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/prims/jvmtiThreadState.cpp b/src/hotspot/share/prims/jvmtiThreadState.cpp index 1264b8b9e37..bafa22b6d58 100644 --- a/src/hotspot/share/prims/jvmtiThreadState.cpp +++ b/src/hotspot/share/prims/jvmtiThreadState.cpp @@ -56,12 +56,7 @@ bool JvmtiThreadState::_seen_interp_only_mode = false; JvmtiThreadState::JvmtiThreadState(JavaThread* thread, oop thread_oop) : _thread_event_enable() { assert(JvmtiThreadState_lock->is_locked(), "sanity check"); - - // The _thread field is a link to the JavaThread associated with JvmtiThreadState. - // A carrier thread shgould always have a stable link to its JavaThread. - // The _thread field of a virtual thread should point to the JavaThread when - // virtual thread is mounted. It should be set to null when it is unmounted. - _thread = thread; + _thread = thread; _exception_state = ES_CLEARED; _hide_single_stepping = false; _pending_interp_only_mode = false; diff --git a/src/hotspot/share/prims/jvmtiThreadState.hpp b/src/hotspot/share/prims/jvmtiThreadState.hpp index 5f2d03a2e81..553b9f59e83 100644 --- a/src/hotspot/share/prims/jvmtiThreadState.hpp +++ b/src/hotspot/share/prims/jvmtiThreadState.hpp @@ -123,6 +123,10 @@ class JvmtiVTSuspender : AllStatic { class JvmtiThreadState : public CHeapObj { private: friend class JvmtiEnv; + // The _thread field is a link to the JavaThread associated with JvmtiThreadState. + // A platform (including carrier) thread should always have a stable link to its JavaThread. + // The _thread field of a virtual thread should point to the JavaThread when + // virtual thread is mounted. It should be set to null when it is unmounted. JavaThread *_thread; OopHandle _thread_oop_h; // Jvmti Events that cannot be posted in their current context.