src/share/vm/prims/jvmtiEnv.cpp
Print this page
*** 1358,1369 ****
// retrieve or create JvmtiThreadState.
JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread);
if (state == NULL) {
return JVMTI_ERROR_THREAD_NOT_ALIVE;
}
! uint32_t debug_bits = 0;
! if (is_thread_fully_suspended(java_thread, true, &debug_bits)) {
err = get_frame_count(state, count_ptr);
} else {
// get java stack frame count at safepoint.
VM_GetFrameCount op(this, state, count_ptr);
VMThread::execute(&op);
--- 1358,1372 ----
// retrieve or create JvmtiThreadState.
JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread);
if (state == NULL) {
return JVMTI_ERROR_THREAD_NOT_ALIVE;
}
!
! // Performance-wise the only important case is when current thread is
! // the target thread. Otherwise, it is Ok and more safe to get frame
! // count at a safepoint, even if the target thread is suspended.
! if (java_thread == JavaThread::current()) {
err = get_frame_count(state, count_ptr);
} else {
// get java stack frame count at safepoint.
VM_GetFrameCount op(this, state, count_ptr);
VMThread::execute(&op);