@@ -36,17 +36,6 @@ using namespace __sanitizer;
36
36
#define SKIP_ON_SOLARIS_SPARCV9 (x ) x
37
37
#endif
38
38
39
- // On 64-bit systems with small virtual address spaces (e.g. 39-bit) we can't
40
- // use size class maps with a large number of classes, as that will make the
41
- // SizeClassAllocator64 region size too small (< 2^32).
42
- #if SANITIZER_ANDROID && defined(__aarch64__)
43
- #define ALLOCATOR64_SMALL_SIZE 1
44
- #elif SANITIZER_RISCV64
45
- #define ALLOCATOR64_SMALL_SIZE 1
46
- #else
47
- #define ALLOCATOR64_SMALL_SIZE 0
48
- #endif
49
-
50
39
// Too slow for debug build
51
40
#if !SANITIZER_DEBUG
52
41
@@ -64,11 +53,6 @@ static const uptr kAllocatorSpace = 0x3000000000ULL;
64
53
static const uptr kAllocatorSize = 0x2000000000ULL ;
65
54
static const u64 kAddressSpaceSize = 1ULL << 39 ;
66
55
typedef VeryCompactSizeClassMap SizeClassMap;
67
- #elif SANITIZER_RISCV64
68
- const uptr kAllocatorSpace = ~(uptr)0 ;
69
- const uptr kAllocatorSize = 0x2000000000ULL ; // 128G.
70
- static const u64 kAddressSpaceSize = 1ULL << 38 ;
71
- typedef VeryDenseSizeClassMap SizeClassMap;
72
56
#else
73
57
static const uptr kAllocatorSpace = 0x700000000000ULL ;
74
58
static const uptr kAllocatorSize = 0x010000000000ULL ; // 1T.
@@ -292,7 +276,8 @@ TEST(SanitizerCommon, SizeClassAllocator64Dynamic) {
292
276
TestSizeClassAllocator<Allocator64Dynamic>();
293
277
}
294
278
295
- #if !ALLOCATOR64_SMALL_SIZE
279
+ #if !SANITIZER_ANDROID
280
+ // FIXME(kostyak): find values so that those work on Android as well.
296
281
TEST (SanitizerCommon, SizeClassAllocator64Compact) {
297
282
TestSizeClassAllocator<Allocator64Compact>();
298
283
}
@@ -376,7 +361,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicMetadataStress) {
376
361
SizeClassAllocatorMetadataStress<Allocator64Dynamic>();
377
362
}
378
363
379
- #if !ALLOCATOR64_SMALL_SIZE
364
+ #if !SANITIZER_ANDROID
380
365
TEST (SanitizerCommon, SizeClassAllocator64CompactMetadataStress) {
381
366
SizeClassAllocatorMetadataStress<Allocator64Compact>();
382
367
}
@@ -423,7 +408,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicGetBlockBegin) {
423
408
SizeClassAllocatorGetBlockBeginStress<Allocator64Dynamic>(
424
409
1ULL << (SANITIZER_ANDROID ? 31 : 33 ));
425
410
}
426
- #if !ALLOCATOR64_SMALL_SIZE
411
+ #if !SANITIZER_ANDROID
427
412
TEST (SanitizerCommon, SizeClassAllocator64CompactGetBlockBegin) {
428
413
SizeClassAllocatorGetBlockBeginStress<Allocator64Compact>(1ULL << 33 );
429
414
}
@@ -535,7 +520,7 @@ TEST(SanitizerCommon, LargeMmapAllocatorMapUnmapCallback) {
535
520
536
521
// Don't test OOM conditions on Win64 because it causes other tests on the same
537
522
// machine to OOM.
538
- #if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
523
+ #if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64 && !SANITIZER_ANDROID
539
524
TEST (SanitizerCommon, SizeClassAllocator64Overflow) {
540
525
Allocator64 a;
541
526
a.Init (kReleaseToOSIntervalNever );
@@ -549,8 +534,7 @@ TEST(SanitizerCommon, SizeClassAllocator64Overflow) {
549
534
uint32_t chunks[kNumChunks ];
550
535
bool allocation_failed = false ;
551
536
for (int i = 0 ; i < 1000000 ; i++) {
552
- uptr class_id = a.kNumClasses - 1 ;
553
- if (!a.GetFromAllocator (&stats, class_id, chunks, kNumChunks )) {
537
+ if (!a.GetFromAllocator (&stats, 52 , chunks, kNumChunks )) {
554
538
allocation_failed = true ;
555
539
break ;
556
540
}
@@ -714,7 +698,7 @@ TEST(SanitizerCommon, CombinedAllocator64Dynamic) {
714
698
TestCombinedAllocator<Allocator64Dynamic>();
715
699
}
716
700
717
- #if !ALLOCATOR64_SMALL_SIZE
701
+ #if !SANITIZER_ANDROID
718
702
TEST (SanitizerCommon, CombinedAllocator64Compact) {
719
703
TestCombinedAllocator<Allocator64Compact>();
720
704
}
@@ -775,7 +759,7 @@ TEST(SanitizerCommon, SizeClassAllocator64DynamicLocalCache) {
775
759
TestSizeClassAllocatorLocalCache<Allocator64Dynamic>();
776
760
}
777
761
778
- #if !ALLOCATOR64_SMALL_SIZE
762
+ #if !SANITIZER_ANDROID
779
763
TEST (SanitizerCommon, SizeClassAllocator64CompactLocalCache) {
780
764
TestSizeClassAllocatorLocalCache<Allocator64Compact>();
781
765
}
@@ -1032,8 +1016,8 @@ TEST(SanitizerCommon, LargeMmapAllocatorBlockBegin) {
1032
1016
1033
1017
// Don't test OOM conditions on Win64 because it causes other tests on the same
1034
1018
// machine to OOM.
1035
- #if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
1036
- typedef __sanitizer::SizeClassMap<2 , 22 , 22 , 34 , 128 , 16 > SpecialSizeClassMap;
1019
+ #if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64 && !SANITIZER_ANDROID
1020
+ typedef __sanitizer::SizeClassMap<3 , 4 , 8 , 38 , 128 , 16 > SpecialSizeClassMap;
1037
1021
template <typename AddressSpaceViewTy = LocalAddressSpaceView>
1038
1022
struct AP64_SpecialSizeClassMap {
1039
1023
static const uptr kSpaceBeg = kAllocatorSpace ;
@@ -1060,15 +1044,15 @@ TEST(SanitizerCommon, SizeClassAllocator64PopulateFreeListOOM) {
1060
1044
// ...one man is on a mission to overflow a region with a series of
1061
1045
// successive allocations.
1062
1046
1063
- const uptr kClassID = kAllocatorSize == ALLOCATOR64_SMALL_SIZE ? 18 : 24 ;
1047
+ const uptr kClassID = 107 ;
1064
1048
const uptr kAllocationSize = SpecialSizeClassMap::Size (kClassID );
1065
1049
ASSERT_LT (2 * kAllocationSize , kRegionSize );
1066
1050
ASSERT_GT (3 * kAllocationSize , kRegionSize );
1067
1051
EXPECT_NE (cache.Allocate (a, kClassID ), nullptr );
1068
1052
EXPECT_NE (cache.Allocate (a, kClassID ), nullptr );
1069
1053
EXPECT_EQ (cache.Allocate (a, kClassID ), nullptr );
1070
1054
1071
- const uptr Class2 = kAllocatorSize == ALLOCATOR64_SMALL_SIZE ? 15 : 21 ;
1055
+ const uptr Class2 = 100 ;
1072
1056
const uptr Size2 = SpecialSizeClassMap::Size (Class2);
1073
1057
ASSERT_EQ (Size2 * 8 , kRegionSize );
1074
1058
char *p[7 ];
@@ -1354,15 +1338,15 @@ TEST(SanitizerCommon, SizeClassAllocator64ReleaseFreeMemoryToOS) {
1354
1338
TestReleaseFreeMemoryToOS<Allocator64>();
1355
1339
}
1356
1340
1357
- #if !ALLOCATOR64_SMALL_SIZE
1341
+ #if !SANITIZER_ANDROID
1358
1342
TEST (SanitizerCommon, SizeClassAllocator64CompactReleaseFreeMemoryToOS) {
1359
1343
TestReleaseFreeMemoryToOS<Allocator64Compact>();
1360
1344
}
1361
1345
1362
1346
TEST (SanitizerCommon, SizeClassAllocator64VeryCompactReleaseFreeMemoryToOS) {
1363
1347
TestReleaseFreeMemoryToOS<Allocator64VeryCompact>();
1364
1348
}
1365
- #endif // !ALLOCATOR64_SMALL_SIZE
1349
+ #endif // !SANITIZER_ANDROID
1366
1350
1367
1351
#endif // SANITIZER_CAN_USE_ALLOCATOR64
1368
1352
0 commit comments