Skip to content

Commit

Permalink
Add support for new VirtualThread states in JVMTI
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Lu <[email protected]>
  • Loading branch information
fengxue-IS authored and JasonFengJ9 committed Nov 13, 2024
1 parent 22733c4 commit 41ede8d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions runtime/jvmti/jvmtiHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,16 +900,33 @@ getVirtualThreadState(J9VMThread *currentThread, jthread thread)
case JVMTI_VTHREAD_STATE_UNPARKED:
case JVMTI_VTHREAD_STATE_YIELDING:
case JVMTI_VTHREAD_STATE_YIELDED:
#if JAVA_SPEC_VERSION >= 24
case JVMTI_VTHREAD_STATE_UNBLOCKED:
case JVMTI_VTHREAD_STATE_WAITING:
case JVMTI_VTHREAD_STATE_TIMED_WAITING:
#endif /* JAVA_SPEC_VERSION >= 24 */
rc = JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE;
break;
case JVMTI_VTHREAD_STATE_PINNED:
case JVMTI_VTHREAD_STATE_PARKED:
#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;
break;
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_BLOCKING:
case JVMTI_VTHREAD_STATE_BLOCKED:
rc = JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED;
break;
#endif /* JAVA_SPEC_VERSION >= 24 */
case JVMTI_VTHREAD_STATE_TERMINATED:
rc = JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED;
break;
Expand Down
9 changes: 9 additions & 0 deletions runtime/oti/jvmtiInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,15 @@ typedef struct jvmtiGcp_translation {
#define JVMTI_VTHREAD_STATE_UNPARKED 9
#define JVMTI_VTHREAD_STATE_YIELDING 10
#define JVMTI_VTHREAD_STATE_YIELDED 11
#if JAVA_SPEC_VERSION >= 24
#define JVMTI_VTHREAD_STATE_BLOCKING 12
#define JVMTI_VTHREAD_STATE_BLOCKED 13
#define JVMTI_VTHREAD_STATE_UNBLOCKED 14
#define JVMTI_VTHREAD_STATE_WAITING 15
#define JVMTI_VTHREAD_STATE_WAIT 16
#define JVMTI_VTHREAD_STATE_TIMED_WAITING 17
#define JVMTI_VTHREAD_STATE_TIMED_WAIT 18
#endif /* JAVA_SPEC_VERSION >= 24 */
#define JVMTI_VTHREAD_STATE_TERMINATED 99
#define JVMTI_VTHREAD_STATE_SUSPENDED (1 << 8)
#endif /* JAVA_SPEC_VERSION >= 19 */
Expand Down

0 comments on commit 41ede8d

Please sign in to comment.