Skip to content

Commit db9dcdf

Browse files
committed
8254668: JVMTI process frames on thread without started processing
Reviewed-by: eosterlund, rrich
1 parent dc262df commit db9dcdf

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/hotspot/share/prims/jvmtiEnv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
16741674
bool is_interpreted[2];
16751675
intptr_t *frame_sp[2];
16761676
// The 2-nd arg of constructor is needed to stop iterating at java entry frame.
1677-
for (vframeStream vfs(java_thread, true); !vfs.at_end(); vfs.next()) {
1677+
for (vframeStream vfs(java_thread, true, false /* process_frames */); !vfs.at_end(); vfs.next()) {
16781678
methodHandle mh(current_thread, vfs.method());
16791679
if (mh->is_native()) return(JVMTI_ERROR_OPAQUE_FRAME);
16801680
is_interpreted[frame_count] = vfs.is_interpreted_frame();
@@ -1686,7 +1686,7 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
16861686
// There can be two situations here:
16871687
// 1. There are no more java frames
16881688
// 2. Two top java frames are separated by non-java native frames
1689-
if(vframeFor(java_thread, 1) == NULL) {
1689+
if(vframeForNoProcess(java_thread, 1) == NULL) {
16901690
return JVMTI_ERROR_NO_MORE_FRAMES;
16911691
} else {
16921692
// Intervening non-java native or VM frames separate java frames.
@@ -1785,7 +1785,7 @@ JvmtiEnv::NotifyFramePop(JavaThread* java_thread, jint depth) {
17851785
JvmtiSuspendControl::print();
17861786
}
17871787

1788-
vframe *vf = vframeFor(java_thread, depth);
1788+
vframe *vf = vframeForNoProcess(java_thread, depth);
17891789
if (vf == NULL) {
17901790
return JVMTI_ERROR_NO_MORE_FRAMES;
17911791
}

src/hotspot/share/prims/jvmtiEnvBase.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,13 @@ JvmtiEnvBase::new_jthreadGroupArray(int length, Handle *handles) {
556556
}
557557

558558
// return the vframe on the specified thread and depth, NULL if no such frame
559+
// The thread and the oops in the returned vframe might not have been process.
559560
vframe*
560-
JvmtiEnvBase::vframeFor(JavaThread* java_thread, jint depth) {
561+
JvmtiEnvBase::vframeForNoProcess(JavaThread* java_thread, jint depth) {
561562
if (!java_thread->has_last_Java_frame()) {
562563
return NULL;
563564
}
564-
RegisterMap reg_map(java_thread);
565+
RegisterMap reg_map(java_thread, true /* update_map */, false /* process_frames */);
565566
vframe *vf = java_thread->last_java_vframe(&reg_map);
566567
int d = 0;
567568
while ((vf != NULL) && (d < depth)) {
@@ -909,7 +910,7 @@ JvmtiEnvBase::get_frame_location(JavaThread *java_thread, jint depth,
909910
"call by myself or at handshake");
910911
ResourceMark rm(current_thread);
911912

912-
vframe *vf = vframeFor(java_thread, depth);
913+
vframe *vf = vframeForNoProcess(java_thread, depth);
913914
if (vf == NULL) {
914915
return JVMTI_ERROR_NO_MORE_FRAMES;
915916
}
@@ -1309,7 +1310,7 @@ JvmtiEnvBase::check_top_frame(Thread* current_thread, JavaThread* java_thread,
13091310
jvalue value, TosState tos, Handle* ret_ob_h) {
13101311
ResourceMark rm(current_thread);
13111312

1312-
vframe *vf = vframeFor(java_thread, 0);
1313+
vframe *vf = vframeForNoProcess(java_thread, 0);
13131314
NULL_CHECK(vf, JVMTI_ERROR_NO_MORE_FRAMES);
13141315

13151316
javaVFrame *jvf = (javaVFrame*) vf;

src/hotspot/share/prims/jvmtiEnvBase.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
286286
javaVFrame *jvf,
287287
GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
288288
jint depth);
289-
vframe* vframeFor(JavaThread* java_thread, jint depth);
289+
vframe* vframeForNoProcess(JavaThread* java_thread, jint depth);
290290

291291
public:
292292
// get a field descriptor for the specified class and field

0 commit comments

Comments
 (0)