Skip to content

Commit

Permalink
Avoid inlining exact_unwind
Browse files Browse the repository at this point in the history
On some architectures this can't be inlined. We don't actually care
whether or not it is inlined, only that whether it is or isn't inlined
is consistent regardless of build flags.

Signed-off-by: Matthias Diener <mdiener@illinois.edu>
Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
  • Loading branch information
matthiasdiener authored and godlygeek committed May 16, 2022
1 parent ffed29e commit 508d7ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/memray/_memray/tracking_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class NativeTrace
if (size == MAX_SIZE) {
d_data.resize(0);
size = exact_unwind();
skip += 1; // skip the non-inlined exact_unwind frame
MAX_SIZE = MAX_SIZE * 2 > size ? MAX_SIZE * 2 : size;
d_data.resize(MAX_SIZE);
}
Expand Down Expand Up @@ -143,7 +144,9 @@ class NativeTrace
return unw_backtrace((void**)data, MAX_SIZE);
}

__attribute__((always_inline)) size_t inline exact_unwind()
// This can not be inlined as some architectures (e.g. ppc64le) don't
// support inlining functions that call setjmp()
__attribute__((noinline)) size_t inline exact_unwind()
{
unw_context_t context;
if (unw_getcontext(&context) < 0) {
Expand Down

0 comments on commit 508d7ff

Please sign in to comment.