[compiler-rt] r359276 - Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 22:19:32 PDT 2019
Author: vitalybuka
Date: Thu Apr 25 22:19:32 2019
New Revision: 359276
URL: http://llvm.org/viewvc/llvm-project?rev=359276&view=rev
Log:
Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"
New static_assert fails on a bot.
This reverts commit r359269.
Modified:
compiler-rt/trunk/lib/lsan/lsan_allocator.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
Modified: compiler-rt/trunk/lib/lsan/lsan_allocator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_allocator.h?rev=359276&r1=359275&r2=359276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_allocator.h (original)
+++ compiler-rt/trunk/lib/lsan/lsan_allocator.h Thu Apr 25 22:19:32 2019
@@ -53,15 +53,9 @@ struct ChunkMetadata {
defined(__arm__)
static const uptr kRegionSizeLog = 20;
static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog;
-
-#if SANITIZER_WORDSIZE == 32
-template <typename AddressSpaceView>
-using ByteMapASVT = FlatByteMap<kNumRegions, AddressSpaceView>;
-#elif SANITIZER_WORDSIZE == 64
template <typename AddressSpaceView>
using ByteMapASVT =
TwoLevelByteMap<(kNumRegions >> 12), 1 << 12, AddressSpaceView>;
-#endif
template <typename AddressSpaceViewTy>
struct AP32 {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h?rev=359276&r1=359275&r2=359276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h Thu Apr 25 22:19:32 2019
@@ -27,7 +27,7 @@ static const uptr kInternalAllocatorNumR
SANITIZER_MMAP_RANGE_SIZE >> kInternalAllocatorRegionSizeLog;
#if SANITIZER_WORDSIZE == 32
typedef FlatByteMap<kInternalAllocatorNumRegions> ByteMap;
-#elif SANITIZER_WORDSIZE == 64
+#else
typedef TwoLevelByteMap<(kInternalAllocatorNumRegions >> 12), 1 << 12> ByteMap;
#endif
struct AP32 {
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=359276&r1=359275&r2=359276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_primary32.h Thu Apr 25 22:19:32 2019
@@ -41,7 +41,6 @@ struct SizeClassAllocator32FlagMasks {
enum {
kRandomShuffleChunks = 1,
kUseSeparateSizeClassForBatch = 2,
- kForTest = 4,
};
};
@@ -57,20 +56,7 @@ class SizeClassAllocator32 {
typedef typename Params::ByteMap ByteMap;
typedef typename Params::MapUnmapCallback MapUnmapCallback;
-#if SANITIZER_WORDSIZE == 32
- using BM = FlatByteMap<(Params::kSpaceSize >> Params::kRegionSizeLog),
- AddressSpaceView>;
-#elif SANITIZER_WORDSIZE == 64
- using BM =
- TwoLevelByteMap<((Params::kSpaceSize >> Params::kRegionSizeLog) >> 12),
- 1 << 12, AddressSpaceView, MapUnmapCallback>;
-#endif
- static_assert((Params::kFlags & SizeClassAllocator32FlagMasks::kForTest) ||
- is_same<BM, ByteMap>::value,
- "Unexpected ByteMap type");
-
static_assert(
-
is_same<typename ByteMap::AddressSpaceView, AddressSpaceView>::value,
"AddressSpaceView type mismatch");
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc?rev=359276&r1=359275&r2=359276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc Thu Apr 25 22:19:32 2019
@@ -59,7 +59,7 @@ struct AP64 { // Allocator Params. Shor
static const uptr kMetadataSize = 16;
typedef ::SizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -70,7 +70,7 @@ struct AP64Dyn {
static const uptr kMetadataSize = 16;
typedef ::SizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -81,7 +81,7 @@ struct AP64Compact {
static const uptr kMetadataSize = 16;
typedef CompactSizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -92,7 +92,7 @@ struct AP64VeryCompact {
static const uptr kMetadataSize = 16;
typedef VeryCompactSizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -103,7 +103,7 @@ struct AP64Dense {
static const uptr kMetadataSize = 16;
typedef DenseSizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -155,7 +155,7 @@ struct AP32Compact {
using AddressSpaceView = AddressSpaceViewTy;
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
};
template <typename AddressSpaceView>
using Allocator32CompactASVT =
@@ -302,8 +302,7 @@ struct AP32SeparateBatches {
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
typedef NoOpMapUnmapCallback MapUnmapCallback;
static const uptr kFlags =
- SizeClassAllocator32FlagMasks::kUseSeparateSizeClassForBatch |
- SizeClassAllocator32FlagMasks::kForTest;
+ SizeClassAllocator32FlagMasks::kUseSeparateSizeClassForBatch;
};
template <typename AddressSpaceView>
using Allocator32SeparateBatchesASVT =
@@ -439,7 +438,7 @@ struct AP64WithCallback {
static const uptr kMetadataSize = 16;
typedef ::SizeClassMap SizeClassMap;
typedef TestMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
@@ -477,7 +476,7 @@ struct AP32WithCallback {
using AddressSpaceView = AddressSpaceViewTy;
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
typedef TestMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
};
TEST(SanitizerCommon, SizeClassAllocator32MapUnmapCallback) {
@@ -1040,7 +1039,7 @@ struct AP64_SpecialSizeClassMap {
static const uptr kMetadataSize = 0;
typedef SpecialSizeClassMap SizeClassMap;
typedef NoOpMapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = AddressSpaceViewTy;
};
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=359276&r1=359275&r2=359276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Thu Apr 25 22:19:32 2019
@@ -69,7 +69,7 @@ struct AP32 {
using AddressSpaceView = LocalAddressSpaceView;
using ByteMap = __tsan::ByteMap;
typedef __tsan::MapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
};
typedef SizeClassAllocator32<AP32> PrimaryAllocator;
#else
@@ -79,7 +79,7 @@ struct AP64 { // Allocator64 parameters
static const uptr kMetadataSize = 0;
typedef DefaultSizeClassMap SizeClassMap;
typedef __tsan::MapUnmapCallback MapUnmapCallback;
- static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
+ static const uptr kFlags = 0;
using AddressSpaceView = LocalAddressSpaceView;
};
typedef SizeClassAllocator64<AP64> PrimaryAllocator;
More information about the llvm-commits
mailing list