8032223: nsk/regression/b4663146 gets assert(SafepointSynchronize::is_at_safepoint() || JvmtiEnv::is_thread_fully_suspended(get_thread(), false, &debug_bits))
It is better to calculate frame count for suspended threads at a safepoint Reviewed-by: twisti, dsamersoff, sla, dholmes, dcubed
This commit is contained in:
parent
731320a7fd
commit
465cfd7c01
@ -1360,8 +1360,10 @@ JvmtiEnv::GetFrameCount(JavaThread* java_thread, jint* count_ptr) {
|
||||
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 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
|
||||
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.
|
||||
|
@ -533,8 +533,12 @@ public:
|
||||
VMOp_Type type() const { return VMOp_GetFrameCount; }
|
||||
jvmtiError result() { return _result; }
|
||||
void doit() {
|
||||
_result = JVMTI_ERROR_THREAD_NOT_ALIVE;
|
||||
JavaThread* jt = _state->get_thread();
|
||||
if (Threads::includes(jt) && !jt->is_exiting() && jt->threadObj() != NULL) {
|
||||
_result = ((JvmtiEnvBase*)_env)->get_frame_count(_state, _count_ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// VM operation to frame location at safepoint.
|
||||
@ -559,9 +563,13 @@ public:
|
||||
VMOp_Type type() const { return VMOp_GetFrameLocation; }
|
||||
jvmtiError result() { return _result; }
|
||||
void doit() {
|
||||
_result = JVMTI_ERROR_THREAD_NOT_ALIVE;
|
||||
if (Threads::includes(_java_thread) && !_java_thread->is_exiting() &&
|
||||
_java_thread->threadObj() != NULL) {
|
||||
_result = ((JvmtiEnvBase*)_env)->get_frame_location(_java_thread, _depth,
|
||||
_method_ptr, _location_ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user