diff --git a/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp b/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp index 1beb0214aa..659dbf5b22 100644 --- a/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp +++ b/src/share/vm/jfr/recorder/stacktrace/jfrStackTraceRepository.cpp @@ -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++; } @@ -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++; }