[PATCH] D44320: [sanitizer] Revert rCRT327145
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 9 12:13:41 PST 2018
cryptoad created this revision.
cryptoad added reviewers: alekseyshl, thakis.
Herald added subscribers: Sanitizers, delcypher, kubamracek.
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 {
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D44320
Files:
lib/sanitizer_common/sanitizer_allocator_primary32.h
lib/sanitizer_common/sanitizer_allocator_primary64.h
lib/sanitizer_common/sanitizer_common.h
Index: lib/sanitizer_common/sanitizer_common.h
===================================================================
--- lib/sanitizer_common/sanitizer_common.h
+++ lib/sanitizer_common/sanitizer_common.h
@@ -40,12 +40,10 @@
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;
Index: lib/sanitizer_common/sanitizer_allocator_primary64.h
===================================================================
--- lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -80,8 +80,6 @@
}
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 @@
static uptr AdditionalSize() {
return RoundUpTo(sizeof(RegionInfo) * kNumClassesRounded,
- GetPageSizeCached());
+ GetPageSizeCached());
}
typedef SizeClassMap SizeClassMapT;
@@ -586,7 +584,7 @@
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 @@
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];
}
Index: lib/sanitizer_common/sanitizer_allocator_primary32.h
===================================================================
--- lib/sanitizer_common/sanitizer_allocator_primary32.h
+++ lib/sanitizer_common/sanitizer_allocator_primary32.h
@@ -266,12 +266,14 @@
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 @@
}
SizeClassInfo *GetSizeClassInfo(uptr class_id) {
- DCHECK_LT(class_id, kNumClasses);
+ CHECK_LT(class_id, kNumClasses);
return &size_class_info_array[class_id];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44320.137813.patch
Type: text/x-patch
Size: 3335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/1aa9d93c/attachment.bin>
More information about the llvm-commits
mailing list