Skip to content

Commit

Permalink
fix JVMTI GetThreadState to check one bit vs whole status word
Browse files Browse the repository at this point in the history
  • Loading branch information
sspitsyn committed Feb 20, 2020
1 parent 127011e commit 1a1449e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jvmtiEnv.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ JvmtiEnv::GetThreadState(jthread thread, jint* thread_state_ptr) {
} }
jshort vthread_state = java_lang_VirtualThread::state(thread_oop); jshort vthread_state = java_lang_VirtualThread::state(thread_oop);


if (vthread_state != java_lang_VirtualThread::RUNNING) { if (!(vthread_state & java_lang_VirtualThread::RUNNING)) {
jint state = (jint) java_lang_VirtualThread::map_state_to_thread_status(vthread_state); jint state = (jint) java_lang_VirtualThread::map_state_to_thread_status(vthread_state);
if (java_lang_Thread::interrupted(thread_oop)) { if (java_lang_Thread::interrupted(thread_oop)) {
state |= JVMTI_THREAD_STATE_INTERRUPTED; state |= JVMTI_THREAD_STATE_INTERRUPTED;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jvmtiEnvBase.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ VM_VirtualThreadGetThreadState::doit() {
oop carrier_thread_oop = java_lang_VirtualThread::carrier_thread(_vthread_h()); oop carrier_thread_oop = java_lang_VirtualThread::carrier_thread(_vthread_h());
jint state; jint state;


if (vthread_state == java_lang_VirtualThread::RUNNING && carrier_thread_oop != NULL) { if ((vthread_state & java_lang_VirtualThread::RUNNING) && carrier_thread_oop != NULL) {
state = java_lang_Thread::get_thread_status(carrier_thread_oop); state = java_lang_Thread::get_thread_status(carrier_thread_oop);
} else { } else {
state = (jint) java_lang_VirtualThread::map_state_to_thread_status(vthread_state); state = (jint) java_lang_VirtualThread::map_state_to_thread_status(vthread_state);
Expand Down

0 comments on commit 1a1449e

Please sign in to comment.