summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_allocator_combined.h
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2016-12-09 03:28:12 +0000
committerKostya Kortchinsky <kostyak@google.com>2016-12-09 03:28:12 +0000
commit2f6cff1b72b413c01b3937d1f3f6b5f674ed929a (patch)
tree9dac082fb62c730111d6e49205755d7b32058113 /lib/sanitizer_common/sanitizer_allocator_combined.h
parentd9dff122a9def308f7125d8f94559b52425b34a0 (diff)
Reverting rL289088 while investigating some test issue on the build servers
Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D27605 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_allocator_combined.h')
-rw-r--r--lib/sanitizer_common/sanitizer_allocator_combined.h15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/sanitizer_common/sanitizer_allocator_combined.h b/lib/sanitizer_common/sanitizer_allocator_combined.h
index a6d086419..de96e2768 100644
--- a/lib/sanitizer_common/sanitizer_allocator_combined.h
+++ b/lib/sanitizer_common/sanitizer_allocator_combined.h
@@ -49,29 +49,16 @@ class CombinedAllocator {
size = 1;
if (size + alignment < size) return ReturnNullOrDieOnBadRequest();
if (check_rss_limit && RssLimitIsExceeded()) return ReturnNullOrDieOnOOM();
- uptr original_size = size;
- // If alignment requirements are to be fulfilled by the frontend allocator
- // rather than by the primary or secondary, passing an alignment lower than
- // or equal to 8 will prevent any further rounding up, as well as the later
- // alignment check.
if (alignment > 8)
size = RoundUpTo(size, alignment);
void *res;
bool from_primary = primary_.CanAllocate(size, alignment);
- // The primary allocator should return a 2^x aligned allocation when
- // requested 2^x bytes, hence using the rounded up 'size' when being
- // serviced by the primary. The secondary takes care of the alignment
- // without such requirement, and allocating 'size' would use extraneous
- // memory, so we employ 'original_size'.
if (from_primary)
res = cache->Allocate(&primary_, primary_.ClassID(size));
else
- res = secondary_.Allocate(&stats_, original_size, alignment);
+ res = secondary_.Allocate(&stats_, size, alignment);
if (alignment > 8)
CHECK_EQ(reinterpret_cast<uptr>(res) & (alignment - 1), 0);
- // When serviced by the secondary, the chunk comes from a mmap allocation
- // and will be zero'd out anyway. We only need to clear our the chunk if
- // it was serviced by the primary, hence using the rounded up 'size'.
if (cleared && res && from_primary)
internal_bzero_aligned16(res, RoundUpTo(size, 16));
return res;