# HG changeset patch # User cjplummer # Date 1471292048 25200 # Node ID 43db0d4b6e14d3f596f0d4d33ee8de1ca79ffe32 # Parent 1ebc8c5aed3010faaf13252bcdd65f6d6e481dbd 8133740: NMT for Linux/x86/x64 and bsd/x64 slowdebug builds includes NativeCallStack::NativeCallStack() frame in backtrace Summary: Skip an extra frame in _get_previous_fp() when it is not inlined. Reviewed-by: dholmes, zgu diff -r 1ebc8c5aed30 -r 43db0d4b6e14 hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Mon Aug 15 13:13:48 2016 -0700 +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp Mon Aug 15 13:14:08 2016 -0700 @@ -417,7 +417,15 @@ #else register intptr_t **ebp __asm__ (SPELL_REG_FP); #endif - return (intptr_t*) *ebp; // we want what it points to. + // ebp is for this frame (_get_previous_fp). We want the ebp for the + // caller of os::current_frame*(), so go up two frames. However, for + // optimized builds, _get_previous_fp() will be inlined, so only go + // up 1 frame in that case. +#ifdef _NMT_NOINLINE_ + return **(intptr_t***)ebp; +#else + return *ebp; +#endif } diff -r 1ebc8c5aed30 -r 43db0d4b6e14 hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Mon Aug 15 13:13:48 2016 -0700 +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Mon Aug 15 13:14:08 2016 -0700 @@ -235,7 +235,15 @@ #else register intptr_t **ebp __asm__ (SPELL_REG_FP); #endif - return (intptr_t*) *ebp; // we want what it points to. + // ebp is for this frame (_get_previous_fp). We want the ebp for the + // caller of os::current_frame*(), so go up two frames. However, for + // optimized builds, _get_previous_fp() will be inlined, so only go + // up 1 frame in that case. +#ifdef _NMT_NOINLINE_ + return **(intptr_t***)ebp; +#else + return *ebp; +#endif } diff -r 1ebc8c5aed30 -r 43db0d4b6e14 hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Mon Aug 15 13:13:48 2016 -0700 +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Mon Aug 15 13:14:08 2016 -0700 @@ -496,7 +496,15 @@ __asm { mov frameptr, ebp }; + // ebp (frameptr) is for this frame (_get_previous_fp). We want the ebp for the + // caller of os::current_frame*(), so go up two frames. However, for + // optimized builds, _get_previous_fp() will be inlined, so only go + // up 1 frame in that case. +#ifdef _NMT_NOINLINE_ + return **(intptr_t***)frameptr; +#else return *frameptr; +#endif } #endif // !AMD64