Commit Graph

805 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
0451d21e83 use libunwind when it actually works
Previously we blindly tried to use libunwind whenever header is
detected. Even if actually working libunwind library is missing. This
is now fixed, so we attempt to use libunwind when it actually works.

Somehow recent freebsd ships libunwind.h (which seems to belong to
llvm's implementation), but apparently without matching .so. So then building
and linking failed.
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
90eff0637b upgrade malloc bench away from std::random_shuffle
C++17 dropped it, so we use C++11 and later std::shuffle
instead. Fixes github issue #1378
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
b501806f2a fix malloc_bench on clang
We got bitten again by compiler optimizing out free(malloc(sz))
combination. We replace calls to malloc/free with calls to global
function operator new/delete. Those are apparently forbidden by
standard to be optimized out.
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
ff68bcab60 [benchmark] detect iterations overflow
If for some reason benchmark function is too fast (like when it got
optimized out to nothing), we'd previously hang in infinite loop. Now
we'll catch this condition due to iterations count overflowing.
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
e003e91b74 drop dependency on PTHREAD_CREATE_JOINABLE 2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
8fc84c29a3 mix thread stack address into sampler
This fixes test failures on freebsd (assert that sampler is seeded
with non-0 value).
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
d9b14b9da1 actually test malloc/free from InitLateMaybeRecursive
This days compilers ~always optimize out free(malloc(N)) to nothing.
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
a80ce7b0e1 slow down profiler_unittest some more
On modern machines xoring volatile int is fast enough to occasionally
make specific test case's profiling results not stable enough. So we
now force atomics into the picture which is slightly slower (could be
lots on some platforms and/or optimizer flags).
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
c37f6c4c7c fix deprecated autoconf bits
As part of that we also upgrade required autoconf version to 2.69
which is what I see in rhel/centos 7 and ubuntu 14.04. Both are old
enough. And, of course, .tar.gz releases still ship "packaged" configure,
so will work on older distros.

This fixes issue #1335.
2023-07-02 21:28:30 -04:00
Aliaksey Kandratsenka
f06052d736 synchronize ucontext-from-pc tests autoconf -> cmake
Refers to github issue #1398.
2023-06-21 10:25:14 -04:00
Henrik Reinstädtler
5e923877aa Fix uc_mcontext for apple silicon 2023-06-19 18:11:10 +02:00
Aliaksey Kandratsenka
bf8b714bf5 bump version to 2.10 2022-05-30 21:21:21 -07:00
Aliaksey Kandratsenka
9d44463380 Remove basic support for Elbrus 2000 (e2k)
This reverts commit 3b1c60cc4e.
2022-05-30 20:33:18 -07:00
Aliaksey Kandratsenka
6c99def347 avoid casting NULL to uinptr_t
Which somehow fails to compile on musl. Fixes issue #1338.
2022-05-30 19:58:15 -07:00
Jingyun Hua
fe85bbdf4c Add support for LoongArch.
Only 64-bit is supported at the moment.

Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
2022-02-08 20:47:10 +08:00
Aliaksey Kandratsenka
e80652b627 ship cmake bits with tar.gz distribution
Fixes issue #1321.
2022-01-14 23:08:57 -08:00
Volodymyr Nikolaichuk
003775aa81 free memory with mmap(PROT_NONE, MAP_FIXED) 2021-12-12 22:29:36 -08:00
Natale Patriciello
852fb6df03 Implement free_definite_size
In Monterey, it seems that free_definite_size is required (despite
the documentation saying that is optional). The implementation
just forward the call to free.

Signed-off-by: Natale Patriciello <natale.patriciello@gmail.com>
2021-12-12 22:28:06 -08:00
stdpain
c25941200e fix cmake gperftools_enable_libunwind invalid 2021-06-20 10:07:42 -07:00
Robert Scott
43504ab709 tcmalloc page fences: add TCMALLOC_PAGE_FENCE_READABLE option 2021-06-20 10:02:06 -07:00
Matt T. Proud
d57a9ea8bc README: replace "golang" moniker with "Go"
This commit replaces the "golang" moniker in the README file with the
appropriate name of "Go" per https://golang.org/doc/faq#go_or_golang.

In this context, no disambiguation is required.
2021-06-20 09:55:45 -07:00
Aliaksey Kandratsenka
f7c6fb6c8e bump version to 2.9.1 2021-03-02 19:32:07 -08:00
Aliaksey Kandratsenka
c2f60400a8 prefer backtrace() on OSX
It seems to work and _Unwind_Backtrace which is configured otherwise
doesn't.
2021-02-28 17:52:17 -08:00
Aliaksey Kandratsenka
a015377a54 Set tcmalloc heap limit prior to testing oom
Otherwise it can take long time to OOM on osex.
2021-02-28 17:47:56 -08:00
Aliaksey Kandratsenka
c939dd5531 correctly check sized delete hint when asserts are on
We previously tested wrong assumption that larger than page size size
classes have addresses aligned on page size. New code is making proper
check of size class.

Also added is unit test coverage for this previously failing
condition. And we now also run "assert-ful" unittests for big tcmalloc
too, not only tcmalloc_minimal configuration.

This fixes github issue #1254
2021-02-28 15:54:22 -08:00
Aliaksey Kandratsenka
47b5b59ca9 bump version to 2.9 2021-02-21 15:16:06 -08:00
Aliaksey Kandratsenka
d7cbc8c2ff unbreak cmake build
It was trying to use third_party/valgrind.h header which I recently
removed.
2021-02-21 15:01:01 -08:00
Aliaksey Kandratsenka
be0bbdb340 amputate various unused bits from elfcore.h 2021-02-21 14:29:40 -08:00
Aliaksey Kandratsenka
42bab59f25 liberate profile handler from linux_syscall_support
We can get thread's tid in more portable way via libc syscall wrapper.
2021-02-21 14:29:34 -08:00
Aliaksey Kandratsenka
4629511e99 liberate spinlock futex waits from linux_syscall_support includes
We've been using libc syscall wrapper some time now.
2021-02-21 14:28:44 -08:00
Aliaksey Kandratsenka
2e7094a862 liberate malloc_hook_mmap_linux.h from linux_syscall_support
It was not used some time now, as we're rightfully trusting libc
syscall wrapper instead.
2021-02-21 14:28:25 -08:00
Aliaksey Kandratsenka
35301e2e59 add missing noopt wrappings around more operator new calls
This fixes tests passing on clang which otherwise eliminates those
new/delete calls so checking for hooks being called failed.
2021-02-21 12:41:36 -08:00
Venkatesh Srinivas
fa412adfe3 Fix thread-safety (annotalysis) annotations
tcmalloc contains some thread-safety annotations; however those
annotations have not been exercised for some time, as they used
macros/attributes only supported by a legacy branch of gcc.

Pull request #1251 converted those macros to support modern
versions of clang; this CR fixes the annotations that were
enabled. For the most part, this just requires re-enabling
annotations on member functions that take/release locks. For the
tcmalloc fork (pre-fork and post-fork) handlers, we mark the
functions as exempt from this analysis, as it takes a dynamic
number of locks.
2021-02-17 17:50:43 -08:00
Venkatesh Srinivas
cc496aecb8 tcmalloc: Switch thread-safety annotations to support clang
tcmalloc contains its own copy of thread_annotations.h, wrapper
macros for static thread-safety analysis expressions. These thread-
safety expressions allow asserting (at compile time) that certain
locks are held or excluded or certain data is protected by specific
locks; they are checked at compile-time by recent versions of clang
or a gcc branch (https://gcc.gnu.org/wiki/ThreadSafetyAnnotation).

Convert the #if-guard and macro names from the no-longer-supported
gcc branch's defines & macros to the versions supported by recent
versions of clang.
2021-02-17 16:23:17 -08:00
Aliaksey Kandratsenka
96ba58e19b bump version to 2.9rc 2021-02-14 23:18:57 -08:00
Aliaksey Kandratsenka
9ce32aefa9 upgrade test bot to xenial (ubuntu 16.04 LTS)
Older glibc seemingly doesn't have right unwind info for signal frame,
so fails recently upgraded stacktrace_unittest. But since this version
is not supported anymore, lets just test newer glibc.
2021-02-14 23:02:28 -08:00
Aliaksey Kandratsenka
91ff311449 don't default to generic_fp without frame pointers
I.e. on x86-64 and riscv.
2021-02-14 22:39:30 -08:00
Aliaksey Kandratsenka
4cf7dd0a75 enable emergency_malloc on all architectures with mmap
It is actually needed for libgcc backtracer from time to time. And
we've seen libunwind to need it too. Plus we've not heard of any
problems with it. So lets just always enable it.

This should fix github issue #1248.
2021-02-14 22:28:34 -08:00
Aliaksey Kandratsenka
37087ec536 prefer libunwind on x86-64 even with -fno-omit-frame-pointer
Libunwind is mostly safe on x86-64 and most of OS (e.g. libc) is
compiled without frame pointers anyways. Even when libc is built with
frame pointers, various libc asm routines (e.g. memcpy) are not. And
even for code built with frame pointers we actually sometimes get
SIGPROF inside function prologues, before frame pointer is
established. Which then causes imperfect backtraces.

Libunwind should handle this all (when it doesn't crash or deadlock).
2021-02-14 22:12:47 -08:00
Aliaksey Kandratsenka
f4aa2a435e implement generic frame pointer backtracer
This supports frame pointer backtracing on x86-64, aarch64 and
riscv-s (should work for both 32 and 64 bits).

Also added is detection of borked libunwind on aarch64-s. In this case
frame pointer unwinder is preferred.
2021-02-14 22:11:09 -08:00
Aliaksey Kandratsenka
17bab484ae always respect --enable-frame-pointers
Previously it only was respected on x86_64, but this days lots of modern
ABIs are without frame pointers by default (e.g. arm64 and riscv, and
even older mips).
2021-02-14 16:44:28 -08:00
Aliaksey Kandratsenka
22c0eceddc add emacs mode line annotations to remaining files 2021-02-14 16:29:14 -08:00
Aliaksey Kandratsenka
b12139ddba delete-trailing-whitespace on all files 2021-02-14 16:13:15 -08:00
Aliaksey Kandratsenka
419c85814d amputate unused dynamic annotations support 2021-02-14 16:09:17 -08:00
Aliaksey Kandratsenka
73a72cdb61 don't check for snprintf 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
95b52b0504 don't check for unused uname symbol 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
01c2697fac amputate unused SleepForMilliseconds from sysinfo.{h,cc} 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
ac68c97187 don't check for useless __builtin_stack_pointer
It doesn't seem to be supported anyways, and we're not using it too.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7271bb72be unbreak cmake check for TLS support 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7c106ca241 don't bother checking for stl namespace and use std
Because there are no compilers left that don't do std namespace.
2021-02-14 15:44:14 -08:00