Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiEnv.cpp @ 14321:e4062d6c5f22
8032223: nsk/regression/b4663146 gets assert(SafepointSynchronize::is_at_safepoint() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits))
Summary: It is better to calculate frame count for suspended threads at a safepoint
Reviewed-by: twisti, dsamersoff, sla, dholmes, dcubed
Contributed-by: serguei.spitsyn@oracle.com
author | sspitsyn |
---|---|
date | Tue, 04 Feb 2014 19:41:46 -0800 |
parents | b8860472c377 |
children | 402677ca28ed |
comparison
equal
deleted
inserted
replaced
14320:602e80a36dfb | 14321:e4062d6c5f22 |
---|---|
1358 // retrieve or create JvmtiThreadState. | 1358 // retrieve or create JvmtiThreadState. |
1359 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); | 1359 JvmtiThreadState* state = JvmtiThreadState::state_for(java_thread); |
1360 if (state == NULL) { | 1360 if (state == NULL) { |
1361 return JVMTI_ERROR_THREAD_NOT_ALIVE; | 1361 return JVMTI_ERROR_THREAD_NOT_ALIVE; |
1362 } | 1362 } |
1363 uint32_t debug_bits = 0; | 1363 |
1364 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { | 1364 // It is only safe to perform the direct operation on the current |
1365 // thread. All other usage needs to use a vm-safepoint-op for safety. | |
1366 if (java_thread == JavaThread::current()) { | |
1365 err = get_frame_count(state, count_ptr); | 1367 err = get_frame_count(state, count_ptr); |
1366 } else { | 1368 } else { |
1367 // get java stack frame count at safepoint. | 1369 // get java stack frame count at safepoint. |
1368 VM_GetFrameCount op(this, state, count_ptr); | 1370 VM_GetFrameCount op(this, state, count_ptr); |
1369 VMThread::execute(&op); | 1371 VMThread::execute(&op); |
1474 // method_ptr - pre-checked for NULL | 1476 // method_ptr - pre-checked for NULL |
1475 // location_ptr - pre-checked for NULL | 1477 // location_ptr - pre-checked for NULL |
1476 jvmtiError | 1478 jvmtiError |
1477 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { | 1479 JvmtiEnv::GetFrameLocation(JavaThread* java_thread, jint depth, jmethodID* method_ptr, jlocation* location_ptr) { |
1478 jvmtiError err = JVMTI_ERROR_NONE; | 1480 jvmtiError err = JVMTI_ERROR_NONE; |
1479 uint32_t debug_bits = 0; | 1481 |
1480 | 1482 // It is only safe to perform the direct operation on the current |
1481 if (is_thread_fully_suspended(java_thread, true, &debug_bits)) { | 1483 // thread. All other usage needs to use a vm-safepoint-op for safety. |
1484 if (java_thread == JavaThread::current()) { | |
1482 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); | 1485 err = get_frame_location(java_thread, depth, method_ptr, location_ptr); |
1483 } else { | 1486 } else { |
1484 // JVMTI get java stack frame location at safepoint. | 1487 // JVMTI get java stack frame location at safepoint. |
1485 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); | 1488 VM_GetFrameLocation op(this, java_thread, depth, method_ptr, location_ptr); |
1486 VMThread::execute(&op); | 1489 VMThread::execute(&op); |