[compiler-rt] r334716 - [scudo] Make Secondary linker-initialized compliant
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 07:33:28 PDT 2018
Author: cryptoad
Date: Thu Jun 14 07:33:28 2018
New Revision: 334716
URL: http://llvm.org/viewvc/llvm-project?rev=334716&view=rev
Log:
[scudo] Make Secondary linker-initialized compliant
Summary:
As a follow up to D48142 for Scudo, switch the `SpinMutex` to its static
counterpart, and ensure zero-initialization by memset'ing the whole class.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48148
Modified:
compiler-rt/trunk/lib/scudo/scudo_allocator_secondary.h
Modified: compiler-rt/trunk/lib/scudo/scudo_allocator_secondary.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_allocator_secondary.h?rev=334716&r1=334715&r2=334716&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_allocator_secondary.h (original)
+++ compiler-rt/trunk/lib/scudo/scudo_allocator_secondary.h Thu Jun 14 07:33:28 2018
@@ -69,11 +69,7 @@ namespace LargeChunk {
class ScudoLargeMmapAllocator {
public:
void Init() {
- NumberOfAllocs = 0;
- NumberOfFrees = 0;
- AllocatedBytes = 0;
- FreedBytes = 0;
- LargestSize = 0;
+ internal_memset(this, 0, sizeof(*this));
}
void *Allocate(AllocatorStats *Stats, uptr Size, uptr Alignment) {
@@ -186,7 +182,7 @@ class ScudoLargeMmapAllocator {
static constexpr uptr HeadersSize =
LargeChunk::getHeaderSize() + Chunk::getHeaderSize();
- SpinMutex StatsMutex;
+ StaticSpinMutex StatsMutex;
u32 NumberOfAllocs;
u32 NumberOfFrees;
uptr AllocatedBytes;
More information about the llvm-commits
mailing list