This is an archive of the discontinued LLVM Phabricator instance.

sanitizer_common: remove debugging logic from the internal allocator
ClosedPublic

Authored by dvyukov on Jul 11 2021, 5:56 AM.

Details

Summary

The internal allocator adds 8-byte header for debugging purposes.
The problem with it is that it's not possible to allocate nicely-sized
objects without a significant overhead. For example, if we allocate
512-byte objects, that will be rounded up to 768 or something.
This logic migrated from tsan where it was added during initial development,
I don't remember that it ever caught anything (we don't do bugs!).
Remove it so that it's possible to allocate nicely-sized objects
without overheads.

Diff Detail

Event Timeline

dvyukov requested review of this revision.Jul 11 2021, 5:56 AM
dvyukov created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2021, 5:56 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
melver accepted this revision.Jul 12 2021, 3:20 AM
This revision is now accepted and ready to land.Jul 12 2021, 3:20 AM
melver added inline comments.Jul 12 2021, 3:21 AM
compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
187

I assume this is inlined? Otherwise the additional level of indirection now seems pointless.

dvyukov added inline comments.Jul 12 2021, 3:27 AM
compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
187

Yes, it is:

$ nm -S test | grep InternalFree
0000000000422940 000000000000014b T _ZN11__sanitizer12InternalFreeEPvPNS_30SizeClassAllocator32LocalCacheINS_20SizeClassAllocator32INS_4AP32EEEEE