[compiler-rt] r327167 - [sanitizer] Revert rCRT327145
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 9 12:17:12 PST 2018
Author: cryptoad
Date: Fri Mar 9 12:17:12 2018
New Revision: 327167
URL: http://llvm.org/viewvc/llvm-project?rev=327167&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h?rev=327167&r1=327166&r2=327167&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h Fri Mar 9 12:17:12 2018
@@ -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];
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h?rev=327167&r1=327166&r2=327167&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary64.h Fri Mar 9 12:17:12 2018
@@ -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];
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=327167&r1=327166&r2=327167&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Fri Mar 9 12:17:12 2018
@@ -40,12 +40,10 @@ const uptr kWordSize = SANITIZER_WORDSIZ
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;
More information about the llvm-commits
mailing list