diff options
| author | Kostya Kortchinsky <kostyak@google.com> | 2018-03-09 20:17:12 +0000 |
|---|---|---|
| committer | Kostya Kortchinsky <kostyak@google.com> | 2018-03-09 20:17:12 +0000 |
| commit | 112d7a435ba93c4a1716eeb9b16644276a58c83e (patch) | |
| tree | 8b26aecead296fd64c2548fe114b920f0e3a426f /compiler-rt | |
| parent | a2f10056d187f3d1c941cb04e8e12b8b12501b8a (diff) | |
| download | bcm5719-llvm-112d7a435ba93c4a1716eeb9b16644276a58c83e.tar.gz bcm5719-llvm-112d7a435ba93c4a1716eeb9b16644276a58c83e.zip | |
[sanitizer] Revert rCRT327145
Summary:
It breaks the Chromium toolchain due to:
```
lib/sanitizer_common/sanitizer_allocator_primary32.h:269:34: error: requested alignment is not an integer constant
struct ALIGNED(kCacheLineSize) SizeClassInfo {
```
Reviewers: alekseyshl, thakis
Reviewed By: thakis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D44320
llvm-svn: 327167
Diffstat (limited to 'compiler-rt')
3 files changed, 13 insertions, 14 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h index dae2c45a82f..4e87bd7fe01 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h @@ -266,12 +266,14 @@ class SizeClassAllocator32 { static const uptr kRegionSize = 1 << kRegionSizeLog; static const uptr kNumPossibleRegions = kSpaceSize / kRegionSize; - struct ALIGNED(kCacheLineSize) SizeClassInfo { + struct SizeClassInfo { SpinMutex mutex; IntrusiveList<TransferBatch> free_list; u32 rand_state; + char padding[kCacheLineSize - 2 * sizeof(uptr) - + sizeof(IntrusiveList<TransferBatch>)]; }; - COMPILER_CHECK(sizeof(SizeClassInfo) % kCacheLineSize == 0); + COMPILER_CHECK(sizeof(SizeClassInfo) == kCacheLineSize); uptr ComputeRegionId(uptr mem) { const uptr res = mem >> kRegionSizeLog; @@ -297,7 +299,7 @@ class SizeClassAllocator32 { } SizeClassInfo *GetSizeClassInfo(uptr class_id) { - DCHECK_LT(class_id, kNumClasses); + CHECK_LT(class_id, kNumClasses); return &size_class_info_array[class_id]; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h index b0042f11b8c..651a64b04f2 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h @@ -80,8 +80,6 @@ class SizeClassAllocator64 { } SetReleaseToOSIntervalMs(release_to_os_interval_ms); MapWithCallbackOrDie(SpaceEnd(), AdditionalSize()); - // Check that the RegionInfo array is aligned on the CacheLine size. - DCHECK_EQ(SpaceEnd() & (kCacheLineSize - 1), 0); } s32 ReleaseToOSIntervalMs() const { @@ -304,7 +302,7 @@ class SizeClassAllocator64 { static uptr AdditionalSize() { return RoundUpTo(sizeof(RegionInfo) * kNumClassesRounded, - GetPageSizeCached()); + GetPageSizeCached()); } typedef SizeClassMap SizeClassMapT; @@ -586,7 +584,7 @@ class SizeClassAllocator64 { u64 last_released_bytes; }; - struct ALIGNED(kCacheLineSize) RegionInfo { + struct RegionInfo { BlockingMutex mutex; uptr num_freed_chunks; // Number of elements in the freearray. uptr mapped_free_array; // Bytes mapped for freearray. @@ -599,11 +597,12 @@ class SizeClassAllocator64 { Stats stats; ReleaseToOsInfo rtoi; }; - COMPILER_CHECK(sizeof(RegionInfo) % kCacheLineSize == 0); + COMPILER_CHECK(sizeof(RegionInfo) >= kCacheLineSize); RegionInfo *GetRegionInfo(uptr class_id) const { - DCHECK_LT(class_id, kNumClasses); - RegionInfo *regions = reinterpret_cast<RegionInfo *>(SpaceEnd()); + CHECK_LT(class_id, kNumClasses); + RegionInfo *regions = + reinterpret_cast<RegionInfo *>(SpaceBeg() + kSpaceSize); return ®ions[class_id]; } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index 8ee36b28148..d06d74eeb01 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -40,12 +40,10 @@ const uptr kWordSize = SANITIZER_WORDSIZE / 8; const uptr kWordSizeInBits = 8 * kWordSize; #if defined(__powerpc__) || defined(__powerpc64__) - constexpr uptr kCacheLineSize = 128; + const uptr kCacheLineSize = 128; #else - constexpr uptr kCacheLineSize = 64; + const uptr kCacheLineSize = 64; #endif -// Check that the CacheLine size is a power-of-two. -COMPILER_CHECK((kCacheLineSize & (kCacheLineSize - 1)) == 0); const uptr kMaxPathLength = 4096; |

