hotspot/src/share/vm/prims/jvmtiEnv.cpp
changeset 22738 e2e6f03308f9
parent 21079 7028d0cb9b49
child 22797 a4bbf1828275
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Mon Feb 03 15:24:20 2014 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Tue Feb 04 19:41:46 2014 -0800
@@ -1360,8 +1360,10 @@
   if (state == NULL) {
     return JVMTI_ERROR_THREAD_NOT_ALIVE;
   }
-  uint32_t debug_bits = 0;
-  if (is_thread_fully_suspended(java_thread, true, &debug_bits)) {
+
+  // It is only safe to perform the direct operation on the current
+  // thread. All other usage needs to use a vm-safepoint-op for safety.
+  if (java_thread == JavaThread::current()) {
     err = get_frame_count(state, count_ptr);
   } else {
     // get java stack frame count at safepoint.
@@ -1476,9 +1478,10 @@
 jvmtiError
 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) {
   jvmtiError err = JVMTI_ERROR_NONE;
-  uint32_t debug_bits = 0;
-
-  if (is_thread_fully_suspended(java_thread, true, &debug_bits)) {
+
+  // It is only safe to perform the direct operation on the current
+  // thread. All other usage needs to use a vm-safepoint-op for safety.
+  if (java_thread == JavaThread::current()) {
     err = get_frame_location(java_thread, depth, method_ptr, location_ptr);
   } else {
     // JVMTI get java stack frame location at safepoint.