8254668: JVMTI process frames on thread without started processing

Reviewed-by: eosterlund, rrich
This commit is contained in:
Stefan Karlsson 2020-10-14 10:29:15 +00:00
parent dc262dfcbf
commit db9dcdf1ae
3 changed files with 9 additions and 8 deletions

View File

@ -1674,7 +1674,7 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
bool is_interpreted[2];
intptr_t *frame_sp[2];
// The 2-nd arg of constructor is needed to stop iterating at java entry frame.
for (vframeStream vfs(java_thread, true); !vfs.at_end(); vfs.next()) {
for (vframeStream vfs(java_thread, true, false /* process_frames */); !vfs.at_end(); vfs.next()) {
methodHandle mh(current_thread, vfs.method());
if (mh->is_native()) return(JVMTI_ERROR_OPAQUE_FRAME);
is_interpreted[frame_count] = vfs.is_interpreted_frame();
@ -1686,7 +1686,7 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
// There can be two situations here:
// 1. There are no more java frames
// 2. Two top java frames are separated by non-java native frames
if(vframeFor(java_thread, 1) == NULL) {
if(vframeForNoProcess(java_thread, 1) == NULL) {
return JVMTI_ERROR_NO_MORE_FRAMES;
} else {
// Intervening non-java native or VM frames separate java frames.
@ -1785,7 +1785,7 @@ JvmtiEnv::NotifyFramePop(JavaThread* java_thread, jint depth) {
JvmtiSuspendControl::print();
}
vframe *vf = vframeFor(java_thread, depth);
vframe *vf = vframeForNoProcess(java_thread, depth);
if (vf == NULL) {
return JVMTI_ERROR_NO_MORE_FRAMES;
}

View File

@ -556,12 +556,13 @@ JvmtiEnvBase::new_jthreadGroupArray(int length, Handle *handles) {
}
// return the vframe on the specified thread and depth, NULL if no such frame
// The thread and the oops in the returned vframe might not have been process.
vframe*
JvmtiEnvBase::vframeFor(JavaThread* java_thread, jint depth) {
JvmtiEnvBase::vframeForNoProcess(JavaThread* java_thread, jint depth) {
if (!java_thread->has_last_Java_frame()) {
return NULL;
}
RegisterMap reg_map(java_thread);
RegisterMap reg_map(java_thread, true /* update_map */, false /* process_frames */);
vframe *vf = java_thread->last_java_vframe(&reg_map);
int d = 0;
while ((vf != NULL) && (d < depth)) {
@ -909,7 +910,7 @@ JvmtiEnvBase::get_frame_location(JavaThread *java_thread, jint depth,
"call by myself or at handshake");
ResourceMark rm(current_thread);
vframe *vf = vframeFor(java_thread, depth);
vframe *vf = vframeForNoProcess(java_thread, depth);
if (vf == NULL) {
return JVMTI_ERROR_NO_MORE_FRAMES;
}
@ -1309,7 +1310,7 @@ JvmtiEnvBase::check_top_frame(Thread* current_thread, JavaThread* java_thread,
jvalue value, TosState tos, Handle* ret_ob_h) {
ResourceMark rm(current_thread);
vframe *vf = vframeFor(java_thread, 0);
vframe *vf = vframeForNoProcess(java_thread, 0);
NULL_CHECK(vf, JVMTI_ERROR_NO_MORE_FRAMES);
javaVFrame *jvf = (javaVFrame*) vf;

View File

@ -286,7 +286,7 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
javaVFrame *jvf,
GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
jint depth);
vframe* vframeFor(JavaThread* java_thread, jint depth);
vframe* vframeForNoProcess(JavaThread* java_thread, jint depth);
public:
// get a field descriptor for the specified class and field