hotspot
hotspot copied to clipboard
Disassembly: per-instruction cost is not shown for inlined code
Describe the bug When disassembling functions containing inlined code, the disassembly view does not show per-line/instruction costs for code inlined from other functions.
To Reproduce Steps to reproduce the behavior:
Compile this program with gcc -g -O2 -o fib main.c :
#include <stdio.h>
unsigned long fib(unsigned long n) {
unsigned long a = 0, b = 1;
for (unsigned long i = 0; i < n; i++) {
unsigned long tmp = a;
a = a + b;
b = tmp;
}
return a;
}
int main() {
printf("%d\n", fib(10000000000));
}
Then profile the binary using Hotspot and open the disassembly view for main.
Expected behavior The disassembly view should show per-line/instruction costs even for inlined code.
Screenshots
The profile in perf report:
The same profile in Hotspot's disassembly view:
If I compile with -fno-inline and disassemble fib instead, the costs show as expected:
Version Info (please complete the following information):
- Linux Kernel version: 6.9.10
- perf version: 6.9
- hotspot version: 1.5.1 (tested both AppImage and compiled from AUR)
Additional context Originally found while profiling Go code, but it seems Go and C binaries behave the same here.