Skip to content

Commit d8e9c3a

Browse files
committed
Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"
New static_assert fails on a bot. This reverts commit r359269. llvm-svn: 359276
1 parent dd0a2e4 commit d8e9c3a

File tree

5 files changed

+13
-34
lines changed

5 files changed

+13
-34
lines changed

compiler-rt/lib/lsan/lsan_allocator.h

-6
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ struct ChunkMetadata {
5353
defined(__arm__)
5454
static const uptr kRegionSizeLog = 20;
5555
static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog;
56-
57-
#if SANITIZER_WORDSIZE == 32
58-
template <typename AddressSpaceView>
59-
using ByteMapASVT = FlatByteMap<kNumRegions, AddressSpaceView>;
60-
#elif SANITIZER_WORDSIZE == 64
6156
template <typename AddressSpaceView>
6257
using ByteMapASVT =
6358
TwoLevelByteMap<(kNumRegions >> 12), 1 << 12, AddressSpaceView>;
64-
#endif
6559

6660
template <typename AddressSpaceViewTy>
6761
struct AP32 {

compiler-rt/lib/sanitizer_common/sanitizer_allocator_internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static const uptr kInternalAllocatorNumRegions =
2727
SANITIZER_MMAP_RANGE_SIZE >> kInternalAllocatorRegionSizeLog;
2828
#if SANITIZER_WORDSIZE == 32
2929
typedef FlatByteMap<kInternalAllocatorNumRegions> ByteMap;
30-
#elif SANITIZER_WORDSIZE == 64
30+
#else
3131
typedef TwoLevelByteMap<(kInternalAllocatorNumRegions >> 12), 1 << 12> ByteMap;
3232
#endif
3333
struct AP32 {

compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h

-14
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ struct SizeClassAllocator32FlagMasks { // Bit masks.
4141
enum {
4242
kRandomShuffleChunks = 1,
4343
kUseSeparateSizeClassForBatch = 2,
44-
kForTest = 4,
4544
};
4645
};
4746

@@ -57,20 +56,7 @@ class SizeClassAllocator32 {
5756
typedef typename Params::ByteMap ByteMap;
5857
typedef typename Params::MapUnmapCallback MapUnmapCallback;
5958

60-
#if SANITIZER_WORDSIZE == 32
61-
using BM = FlatByteMap<(Params::kSpaceSize >> Params::kRegionSizeLog),
62-
AddressSpaceView>;
63-
#elif SANITIZER_WORDSIZE == 64
64-
using BM =
65-
TwoLevelByteMap<((Params::kSpaceSize >> Params::kRegionSizeLog) >> 12),
66-
1 << 12, AddressSpaceView, MapUnmapCallback>;
67-
#endif
68-
static_assert((Params::kFlags & SizeClassAllocator32FlagMasks::kForTest) ||
69-
is_same<BM, ByteMap>::value,
70-
"Unexpected ByteMap type");
71-
7259
static_assert(
73-
7460
is_same<typename ByteMap::AddressSpaceView, AddressSpaceView>::value,
7561
"AddressSpaceView type mismatch");
7662

compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cc

+10-11
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct AP64 { // Allocator Params. Short name for shorter demangled names..
5959
static const uptr kMetadataSize = 16;
6060
typedef ::SizeClassMap SizeClassMap;
6161
typedef NoOpMapUnmapCallback MapUnmapCallback;
62-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
62+
static const uptr kFlags = 0;
6363
using AddressSpaceView = AddressSpaceViewTy;
6464
};
6565

@@ -70,7 +70,7 @@ struct AP64Dyn {
7070
static const uptr kMetadataSize = 16;
7171
typedef ::SizeClassMap SizeClassMap;
7272
typedef NoOpMapUnmapCallback MapUnmapCallback;
73-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
73+
static const uptr kFlags = 0;
7474
using AddressSpaceView = AddressSpaceViewTy;
7575
};
7676

@@ -81,7 +81,7 @@ struct AP64Compact {
8181
static const uptr kMetadataSize = 16;
8282
typedef CompactSizeClassMap SizeClassMap;
8383
typedef NoOpMapUnmapCallback MapUnmapCallback;
84-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
84+
static const uptr kFlags = 0;
8585
using AddressSpaceView = AddressSpaceViewTy;
8686
};
8787

@@ -92,7 +92,7 @@ struct AP64VeryCompact {
9292
static const uptr kMetadataSize = 16;
9393
typedef VeryCompactSizeClassMap SizeClassMap;
9494
typedef NoOpMapUnmapCallback MapUnmapCallback;
95-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
95+
static const uptr kFlags = 0;
9696
using AddressSpaceView = AddressSpaceViewTy;
9797
};
9898

@@ -103,7 +103,7 @@ struct AP64Dense {
103103
static const uptr kMetadataSize = 16;
104104
typedef DenseSizeClassMap SizeClassMap;
105105
typedef NoOpMapUnmapCallback MapUnmapCallback;
106-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
106+
static const uptr kFlags = 0;
107107
using AddressSpaceView = AddressSpaceViewTy;
108108
};
109109

@@ -155,7 +155,7 @@ struct AP32Compact {
155155
using AddressSpaceView = AddressSpaceViewTy;
156156
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
157157
typedef NoOpMapUnmapCallback MapUnmapCallback;
158-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
158+
static const uptr kFlags = 0;
159159
};
160160
template <typename AddressSpaceView>
161161
using Allocator32CompactASVT =
@@ -302,8 +302,7 @@ struct AP32SeparateBatches {
302302
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
303303
typedef NoOpMapUnmapCallback MapUnmapCallback;
304304
static const uptr kFlags =
305-
SizeClassAllocator32FlagMasks::kUseSeparateSizeClassForBatch |
306-
SizeClassAllocator32FlagMasks::kForTest;
305+
SizeClassAllocator32FlagMasks::kUseSeparateSizeClassForBatch;
307306
};
308307
template <typename AddressSpaceView>
309308
using Allocator32SeparateBatchesASVT =
@@ -439,7 +438,7 @@ struct AP64WithCallback {
439438
static const uptr kMetadataSize = 16;
440439
typedef ::SizeClassMap SizeClassMap;
441440
typedef TestMapUnmapCallback MapUnmapCallback;
442-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
441+
static const uptr kFlags = 0;
443442
using AddressSpaceView = AddressSpaceViewTy;
444443
};
445444

@@ -477,7 +476,7 @@ struct AP32WithCallback {
477476
using AddressSpaceView = AddressSpaceViewTy;
478477
using ByteMap = FlatByteMap<kFlatByteMapSize, AddressSpaceView>;
479478
typedef TestMapUnmapCallback MapUnmapCallback;
480-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
479+
static const uptr kFlags = 0;
481480
};
482481

483482
TEST(SanitizerCommon, SizeClassAllocator32MapUnmapCallback) {
@@ -1040,7 +1039,7 @@ struct AP64_SpecialSizeClassMap {
10401039
static const uptr kMetadataSize = 0;
10411040
typedef SpecialSizeClassMap SizeClassMap;
10421041
typedef NoOpMapUnmapCallback MapUnmapCallback;
1043-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
1042+
static const uptr kFlags = 0;
10441043
using AddressSpaceView = AddressSpaceViewTy;
10451044
};
10461045

compiler-rt/lib/tsan/rtl/tsan_rtl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct AP32 {
6969
using AddressSpaceView = LocalAddressSpaceView;
7070
using ByteMap = __tsan::ByteMap;
7171
typedef __tsan::MapUnmapCallback MapUnmapCallback;
72-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
72+
static const uptr kFlags = 0;
7373
};
7474
typedef SizeClassAllocator32<AP32> PrimaryAllocator;
7575
#else
@@ -79,7 +79,7 @@ struct AP64 { // Allocator64 parameters. Deliberately using a short name.
7979
static const uptr kMetadataSize = 0;
8080
typedef DefaultSizeClassMap SizeClassMap;
8181
typedef __tsan::MapUnmapCallback MapUnmapCallback;
82-
static const uptr kFlags = SizeClassAllocator32FlagMasks::kForTest;
82+
static const uptr kFlags = 0;
8383
using AddressSpaceView = LocalAddressSpaceView;
8484
};
8585
typedef SizeClassAllocator64<AP64> PrimaryAllocator;

0 commit comments

Comments
 (0)