Commit Graph

1019 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
61b1e05848 unbreak make dist
In 57d6ecc4ae I removed obsolete
src/windows/TODO but failed to remove it from Makefile.am

I also previously failed to arrange distribution of vendored
googletest. And we also failed to distribute headers in src/tests/

This is all fixed now.
2024-02-21 13:44:17 -05:00
Aliaksey Kandratsenka
0906dacc48 gtestify more tests
Those are malloc_hook_test, mmap_hook_test, page_heap_test,
sampler_test, stack_trace_table_test.
2024-02-20 14:34:28 -05:00
Aliaksey Kandratsenka
bfa30bf7df gtestify 3 simpler tests
Those are packed-cache_test, pagemap_unittest, safe_strerror_test
2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
ff2dce5e67 gtestify addressmap_unittest 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
c1799405ae gtestify check_address_test 2024-02-20 14:34:23 -05:00
Aliaksey Kandratsenka
a46a391b14 gtestify low_level_alloc_unittest 2024-02-20 14:34:20 -05:00
Aliaksey Kandratsenka
6c24a59682 introduce vendor copy of googletest 2024-02-20 14:30:24 -05:00
Aliaksey Kandratsenka
ad6e29e7c9 move gtest-like asserts into legacy_assertions.h 2024-02-20 14:24:12 -05:00
Aliaksey Kandratsenka
8318e08962 fix missing AM_CXXFLAGS introduced in recent automake refactoring 2024-02-20 12:06:30 -05:00
oPiZiL
b02d36d2eb fix compile error with gcc 7.5
In file included from /home/louwei/arcs/gperftools/src/span.cc:41:0:
/home/louwei/arcs/gperftools/src/static_vars.h:125:37: error: ‘byte’ in namespace ‘std’ does not name a type
     alignas(alignof(PageHeap)) std::byte memory[sizeof(PageHeap)];
                                     ^~~~
/home/louwei/arcs/gperftools/src/static_vars.h: In static member function ‘static tcmalloc::PageHeap* tcmalloc::Static::pageheap()’:
/home/louwei/arcs/gperftools/src/static_vars.h:76:80: error: ‘struct tcmalloc::Static::<unnamed>’ has no member named ‘memory’
   static PageHeap* pageheap() { return reinterpret_cast<PageHeap *>(&pageheap_.memory); }
                                                                                ^~~~~~
2024-02-19 11:21:08 -05:00
Aliaksey Kandratsenka
3d155f6624 apply tcmalloc::FunctionRef in AddressMap 2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
8c1a7ef17f implement tcmalloc::FunctionRef 2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
5f92c0616a implement tcmalloc::Cleanup
This is similar, but slightly less featureful than
absl::{Make,}Cleanup.
2024-02-17 20:10:21 -05:00
Aliaksey Kandratsenka
dec85dcc03 avoid undefined behavior when parsing proc maps
Clang's undefined behavior sanitized correctly pointed out that
memmove requires non-nil args, so lets initialize sbuf to something.
2024-02-17 18:32:03 -05:00
Aliaksey Kandratsenka
9b5838f084 modernize overalignment testing bits 2024-02-17 18:32:03 -05:00
Aliaksey Kandratsenka
3a2a7e05f6 add missing internal_logging.cc to packed_cache_test
It wasn't caught before because when optimization is enabled ASSERT-s
inside packed-cache-inl get optimized away (because checks are
tautological).
2024-02-17 18:03:41 -05:00
Aliaksey Kandratsenka
57d6ecc4ae drop obsolete src/windows/TODO 2024-02-08 09:41:38 -05:00
Aliaksey Kandratsenka
8a147b4833 untangle a number of unittests from libtcmalloc_minimal.so 2024-02-07 23:54:03 -05:00
Aliaksey Kandratsenka
cad457ad23 actualize .gitignore 2024-02-07 20:30:53 -05:00
Aliaksey Kandratsenka
b0e2928343 mingw: don't add patch_functions.cc in libcommon.la 2024-02-07 20:30:53 -05:00
Aliaksey Kandratsenka
e544d402f7 amputate unused log_message_write 2024-02-07 19:40:08 -05:00
Aliaksey Kandratsenka
b6798a5130 amputate unused kCrashWithStats 2024-02-07 19:40:08 -05:00
Aliaksey Kandratsenka
45a4ad8b70 mmap_hook_test: don't printf early
The test includes override of
MallocHook_InitAtFirstAllocation_HeapLeakChecker which runs early
enough to trigger FreeBSD bug of not having nearly anything working
early.
2024-02-07 19:37:04 -05:00
Aliaksey Kandratsenka
e7f576d9f1 generic_writer_test: crash with message if tmpfile fails 2024-02-07 19:36:41 -05:00
Aliaksey Kandratsenka
7756b4cc61 don't force TMPDIR on all unittests
Turns out at least on FreeBSD tmpfile will fail if TMPDIR points to
non-existant directory. This also has nice property of leaving it down
to users to set up TMPDIR the way they want.
2024-02-07 19:35:37 -05:00
Aliaksey Kandratsenka
c52c321bdd replace raw printer with usage of generic writer facility 2024-02-07 15:46:54 -05:00
Aliaksey Kandratsenka
88adbbdb95 generalize FileGenericWriter
There is now WriteFnWriter which allows us to use lambdas for a
function that saves accumulated bytes.
2024-02-07 15:46:49 -05:00
Aliaksey Kandratsenka
59f0247033 liberate sampler_test from linking to libtcmalloc
This test is exercising purely sampling interval logic.
2024-02-07 15:45:25 -05:00
Aliaksey Kandratsenka
a02ac30bbf rework and optimize structure of Makefile.am
There were far too many intermediate libraries, references to obsolete
libtool bugs and whatnot.

We now have libcommon.la as a convenience archive that contains
spinlock, logging and misc stuff. A number of unit tests that need
those facilities are being linked to this.

Then we have libstacktrace.la convenience archive, since it is used by
libtcmalloc.la and libprofiler.la.

And after that we're simply directly creating our main library
products: libtcmalloc_minimal{,_debug}.la, libtcmalloc_{,debug}.la,
libprofiler.la etc.
2024-02-07 15:45:22 -05:00
Aliaksey Kandratsenka
771a01ed28 rework and simplify emergency malloc integration
We now wrap StackTraceScope thingy in tcmalloc-specific parts, instead
of automagically inside every stacktrace.cc function. TCMalloc bits
all need to grab stacktraces via newly introduced
tcmalloc::GrabBacktrace (which handles emergency malloc wrapping).

New approach eliminates the need for doing fake stacktrace scope. CPU
profiler, being distinct .so library couldn't take advantage of
emergency malloc anyways.

This simplifies the build further and eliminates another potential
point of runtime divergence when stacktrace is linked to both
libprofiler and libtcmalloc.
2024-02-05 14:27:02 -05:00
Aliaksey Kandratsenka
4be76ab707 drop symbols weakening step
It has questionable value and most importantly, it was broken lots of
years without anyone complaining. So lets get things simpler.
2024-02-05 00:00:00 -05:00
Aliaksey Kandratsenka
ca50448a1e drop export-symbols-regex stuff for libstacktrace.la
It has no effect, because libstacktrace.la is convenience archive, not
a library we install.
2024-02-04 23:56:08 -05:00
Aliaksey Kandratsenka
ba3d790855 drop running pprof -test as part of make check
Not needed anymore.
2024-02-04 23:46:39 -05:00
Aliaksey Kandratsenka
144c118f92 drop outdated comment in Makefile.am 2024-02-04 23:42:58 -05:00
Aliaksey Kandratsenka
e262ebc741 ship everything under vsprojects/ in make dist
We also drop all those WINDOWS_PROJECTS amends and simplify makefile.
2024-02-04 23:38:18 -05:00
Aliaksey Kandratsenka
b49920ea64 don't bother listing every header in Makefile.am
For compiling things automake never needs to be given a full set of
headers. Usually headers are specified so that make dist includes them
into archive, but we can achieve this goal easier.

This reduces size and complexity of our Makefile.am stuff.
2024-02-04 23:20:35 -05:00
Aliaksey Kandratsenka
1331c0e0d1 drop long deprecated google/ headers 2024-02-04 21:54:46 -05:00
Aliaksey Kandratsenka
a05bab586a align CentralFreeList on cache line size instead of just 64
We had hardcoded size alignment on 64 bytes, seemingly to avoid
cacheline contention when taking per-size-class central free list
locks. But it makes more sense to do platform specific alignment.

I did consider std::hardware_constructive_interference_size, but
practical values seem to differ from what we have configured at least
on some platforms.
2024-02-04 19:33:12 -05:00
Aliaksey Kandratsenka
353816fd9d drop LINKER_INITIALIZED in favor of constexpr constructors 2024-02-04 19:18:33 -05:00
Aliaksey Kandratsenka
247b7f3370 use std::thread when spawning threads in tests 2024-02-04 16:39:02 -05:00
Aliaksey Kandratsenka
2e5ecb4de6 amputate src/base/simple_mutex.h
Use standard mutex instead
2024-02-04 16:38:21 -05:00
Aliaksey Kandratsenka
885dd867bc liberate code base from legacy fixed size int types
I.e. all those int32 etc type (without _t at the end). We stick to
standard. Google/Abseil code base has long been liberated as well.
2024-02-04 15:47:21 -05:00
Aliaksey Kandratsenka
de22f024fb globally replace COMPILE_ASSERT with static_assert 2024-02-04 15:05:45 -05:00
Aliaksey Kandratsenka
c56764c3e6 tcmalloc_unittest: do 64-bit shift when computing alignment
Thanks goes to MSVC for warning about this.
2024-02-04 14:55:25 -05:00
Aliaksey Kandratsenka
329e9adfa6 fix MSVC warning on flexible data member extension 2024-02-04 14:55:10 -05:00
Aliaksey Kandratsenka
f910729012 turn inline ATTRIBUTE_ALWAYS_INLINE -> ALWAYS_INLINE
gcc needs both inline and __attribute__((always_inline)), while MSVC
only needs __forceinline. So relevant correct combination is now just
ALWAYS_INLINE macro.
2024-02-04 14:53:52 -05:00
Aliaksey Kandratsenka
57660e6a54 fix MSVC warning on thread annotations 2024-02-04 14:53:34 -05:00
Aliaksey Kandratsenka
5ec6f60bd7 suppress thread-safety warning for ThreadCachePtr
It is slightly less great that we have to disable thread-safety
analysis, but they explicitly say that optional locking is not
supported. And ours is very explicitly optional locking. I.e. we only
let ourselves resort to slow locking very early during process
startup, when TLS isn't 100% ready and safe to use yet.
2024-02-04 13:43:57 -05:00
Aliaksey Kandratsenka
78e7b959a7 fix clang warning for CreateBadTLSCache 2024-02-04 13:42:38 -05:00
Aliaksey Kandratsenka
21e66f807c enable -Wthread-safety for clang 2024-02-04 13:37:53 -05:00