[llvm-commits] [compiler-rt] r169361 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
Kostya Serebryany
kcc at google.com
Tue Dec 4 23:11:47 PST 2012
Author: kcc
Date: Wed Dec 5 01:11:47 2012
New Revision: 169361
URL: http://llvm.org/viewvc/llvm-project?rev=169361&view=rev
Log:
[tsan] make the 64-bit allocator build (but not work) in 32-bit mode to simplify the code and test structure and allow further refactoring
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h?rev=169361&r1=169360&r2=169361&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator64.h Wed Dec 5 01:11:47 2012
@@ -20,12 +20,10 @@
#include "sanitizer_allocator.h"
-#if SANITIZER_WORDSIZE != 64
-# error "sanitizer_allocator64.h can only be used on 64-bit platforms"
-#endif
-
namespace __sanitizer {
+// SizeClassAllocator64 -- allocator for 64-bit address space.
+//
// Space: a portion of address space of kSpaceSize bytes starting at
// a fixed address (kSpaceBeg). Both constants are powers of two and
// kSpaceBeg is kSpaceSize-aligned.
@@ -143,10 +141,11 @@
static const uptr kNumClasses = SizeClassMap::kNumClasses; // 2^k <= 256
private:
+ static const uptr kRegionSize = kSpaceSize / kNumClasses;
COMPILER_CHECK(kSpaceBeg % kSpaceSize == 0);
COMPILER_CHECK(kNumClasses <= SizeClassMap::kNumClasses);
- static const uptr kRegionSize = kSpaceSize / kNumClasses;
- COMPILER_CHECK((kRegionSize >> 32) > 0); // kRegionSize must be >= 2^32.
+ // kRegionSize must be >= 2^32.
+ COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)));
// Populate the free list with at most this number of bytes at once
// or with one element if its size is greater.
static const uptr kPopulateSize = 1 << 18;
More information about the llvm-commits
mailing list