Skip to content

Commit 9a014ee

Browse files
authored
Merge pull request #18951 from babsingh/main1
Update JVMTI GetThreadState for an unmounted carrier thread
2 parents 1690101 + e8dcc2e commit 9a014ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

runtime/jvmti/jvmtiHelpers.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,15 @@ getThreadState(J9VMThread *currentThread, j9object_t threadObject)
805805
jint state = getThreadStateHelper(currentThread, threadObject, vmThread);
806806

807807
#if JAVA_SPEC_VERSION >= 19
808-
if (J9_ARE_ANY_BITS_SET(state, JVMTI_THREAD_STATE_RUNNABLE)) {
808+
if (J9_ARE_ANY_BITS_SET(state, JVMTI_THREAD_STATE_ALIVE)) {
809809
if ((NULL != vmThread->currentContinuation)
810810
&& (vmThread->threadObject != vmThread->carrierThreadObject)
811811
) {
812812
/* If a virtual thread is mounted on a carrier thread, then the carrier thread
813-
* is considered implicitly parked.
813+
* is considered implicitly parked, and all other bits except ALIVE and SUSPENDED
814+
* are removed from the bitmask.
814815
*/
815-
state &= ~JVMTI_THREAD_STATE_RUNNABLE;
816+
state &= (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_SUSPENDED);
816817
state |= JVMTI_THREAD_STATE_WAITING_INDEFINITELY;
817818
state |= JVMTI_THREAD_STATE_WAITING;
818819
}

0 commit comments

Comments
 (0)