Skip to content

Commit

Permalink
8264017: Correctly report inlined frame in JFR sampling
Browse files Browse the repository at this point in the history
Reviewed-by: jbachorik, mgronlun
  • Loading branch information
Tom Rodriguez committed Mar 26, 2021
1 parent d6bb153 commit 054e0a4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,20 @@ bool JfrStackTrace::record_thread(JavaThread& thread, frame& frame) {
} else {
bci = st.bci();
}

intptr_t* frame_id = st.frame_id();
st.samples_next();
if (type == JfrStackFrame::FRAME_JIT && !st.at_end() && frame_id == st.frame_id()) {
// This frame and the caller frame are both the same physical
// frame, so this frame is inlined into the caller.
type = JfrStackFrame::FRAME_INLINE;
}

const int lineno = method->line_number_from_bci(bci);
// Can we determine if it's inlined?
_hash = (_hash * 31) + mid;
_hash = (_hash * 31) + bci;
_hash = (_hash * 31) + type;
_frames[count] = JfrStackFrame(mid, bci, type, lineno, method->method_holder());
st.samples_next();
count++;
}

Expand Down Expand Up @@ -259,11 +266,18 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
else {
bci = vfs.bci();
}
intptr_t* frame_id = vfs.frame_id();
vfs.next();
if (type == JfrStackFrame::FRAME_JIT && !vfs.at_end() && frame_id == vfs.frame_id()) {
// This frame and the caller frame are both the same physical
// frame, so this frame is inlined into the caller.
type = JfrStackFrame::FRAME_INLINE;
}

_hash = (_hash * 31) + mid;
_hash = (_hash * 31) + bci;
_hash = (_hash * 31) + type;
_frames[count] = JfrStackFrame(mid, bci, type, method->method_holder());
vfs.next();
count++;
}

Expand Down

1 comment on commit 054e0a4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.