8265218: trace_method_handle_stub fails to find calling frame on x86

Reviewed-by: dholmes, dcubed
This commit is contained in:
Vladimir Ivanov 2021-04-22 12:17:24 +00:00
parent 86bd44fe80
commit e16d568c1f
2 changed files with 9 additions and 4 deletions

View File

@ -555,18 +555,25 @@ void trace_method_handle_stub(const char* adaptername,
PreserveExceptionMark pem(Thread::current());
FrameValues values;
// Current C frame
frame cur_frame = os::current_frame();
if (cur_frame.fp() != 0) { // not walkable
// Robust search of trace_calling_frame (independent of inlining).
// Assumes saved_regs comes from a pusha in the trace_calling_frame.
//
// We have to start the search from cur_frame, because trace_calling_frame may be it.
// It is guaranteed that trace_calling_frame is different from the top frame.
// But os::current_frame() does NOT return the top frame: it returns the next frame under it (caller's frame).
// (Due to inlining and tail call optimizations, caller's frame doesn't necessarily correspond to the immediate
// caller in the source code.)
assert(cur_frame.sp() < saved_regs, "registers not saved on stack ?");
frame trace_calling_frame = os::get_sender_for_C_frame(&cur_frame);
frame trace_calling_frame = cur_frame;
while (trace_calling_frame.fp() < saved_regs) {
assert(trace_calling_frame.cb() == NULL, "not a C frame");
trace_calling_frame = os::get_sender_for_C_frame(&trace_calling_frame);
}
assert(trace_calling_frame.sp() < saved_regs, "wrong frame");
// safely create a frame and call frame::describe
intptr_t *dump_sp = trace_calling_frame.sender_sp();

View File

@ -29,8 +29,6 @@
vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java 8205957 generic-all
runtime/logging/RedefineClasses.java 8265218 linux-x64,macosx-x64
vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 windows-x64
vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java#id1 8265349 generic-all