Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions runtime/jvmti/jvmtiHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,21 @@ getVirtualThreadState(J9VMThread *currentThread, jthread thread)
break;
case JVMTI_VTHREAD_STATE_PINNED:
case JVMTI_VTHREAD_STATE_PARKED:
rc = JVMTI_JAVA_LANG_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_PARKED;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JVMTI_JAVA_LANG_THREAD_STATE_WAITING was only introuced in JDK24. Appropriate ifdefs will need to be added. Otherwise, older JDKs will behave incorrectly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you thinking of JVMTI_VTHREAD_STATE_WAIT? It looks like JVMTI_JAVA_LANG_THREAD_STATE_WAITING has been in the code base for several years.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I read too quickly. i will launch the PR builds

break;
#if JAVA_SPEC_VERSION >= 24
case JVMTI_VTHREAD_STATE_WAIT:
#endif /* JAVA_SPEC_VERSION >= 24 */
rc = JVMTI_JAVA_LANG_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_PARKED;
rc = JVMTI_JAVA_LANG_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_IN_OBJECT_WAIT;
break;
#endif /* JAVA_SPEC_VERSION >= 24 */
case JVMTI_VTHREAD_STATE_TIMED_PINNED:
case JVMTI_VTHREAD_STATE_TIMED_PARKED:
#if JAVA_SPEC_VERSION >= 24
case JVMTI_VTHREAD_STATE_TIMED_WAIT:
#endif /* JAVA_SPEC_VERSION >= 24 */
rc = JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING | JVMTI_THREAD_STATE_PARKED;
break;
#if JAVA_SPEC_VERSION >= 24
case JVMTI_VTHREAD_STATE_TIMED_WAIT:
rc = JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING | JVMTI_THREAD_STATE_IN_OBJECT_WAIT;
break;
case JVMTI_VTHREAD_STATE_BLOCKING:
case JVMTI_VTHREAD_STATE_BLOCKED:
rc = JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED;
Expand Down
4 changes: 2 additions & 2 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ typedef void(*j9_tls_finalizer_t)(void *);
#endif /* JAVA_SPEC_VERSION >= 19 */

#if JAVA_SPEC_VERSION >= 24
/* Constants from java.lang.VirutalThread.state that are used by the VM.
* The full mapping is under jvmtiInternals.h <JVMTI_VTHREAD_STATE_*>.
/* Constants from java.lang.VirtualThread.state that are used by the VM.
* The full mapping is under jvmtiInternal.h <JVMTI_VTHREAD_STATE_*>.
*/
#define JAVA_LANG_VIRTUALTHREAD_BLOCKING 12
#define JAVA_LANG_VIRTUALTHREAD_BLOCKED 13
Expand Down