8133740: NMT for Linux/x86/x64 and bsd/x64 slowdebug builds includes NativeCallStack::NativeCallStack() frame in backtrace

Skip an extra frame in _get_previous_fp() when it is not inlined.

Reviewed-by: dholmes, zgu
This commit is contained in:
Chris Plummer 2016-08-15 13:14:08 -07:00
parent eabe746ff6
commit e3c3a54f7a
3 changed files with 26 additions and 2 deletions
hotspot/src/os_cpu
bsd_x86/vm
linux_x86/vm
windows_x86/vm

@ -417,7 +417,15 @@ intptr_t* _get_previous_fp() {
#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
}

@ -235,7 +235,15 @@ intptr_t* _get_previous_fp() {
#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
}

@ -496,7 +496,15 @@ intptr_t* _get_previous_fp() {
__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