Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
[GR-30340] Correctly report inlined frame in JFR sampling (JDK-8264017).
Browse files Browse the repository at this point in the history
PullRequest: graal-jvmci-8/385
  • Loading branch information
tkrodriguez committed Mar 29, 2021
2 parents 87677d4 + 7d4136c commit c2a68aa
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,18 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip, bool leakp /* fals
} else {
bci = vfs.bci();
}
// Can we determine if it's inlined?
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);
vfs.next();
count++;
}

Expand Down Expand Up @@ -429,13 +435,19 @@ 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);
st.samples_next();
count++;
}

Expand Down

0 comments on commit c2a68aa

Please sign in to comment.