--- old/src/share/vm/prims/jvmtiEnv.cpp Fri Jan 31 18:16:02 2014 +++ new/src/share/vm/prims/jvmtiEnv.cpp Fri Jan 31 18:16:02 2014 @@ -1360,8 +1360,11 @@ if (state == NULL) { return JVMTI_ERROR_THREAD_NOT_ALIVE; } - uint32_t debug_bits = 0; - if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { + + // 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.