[compiler-rt] cad961b - [NFC][Asan] Remove from_memalign and rz_log
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 23:55:03 PDT 2020
Author: Vitaly Buka
Date: 2020-09-14T23:54:54-07:00
New Revision: cad961bb24d3b1ec63571e8cac6aa8b16245f95b
URL: https://github.com/llvm/llvm-project/commit/cad961bb24d3b1ec63571e8cac6aa8b16245f95b
DIFF: https://github.com/llvm/llvm-project/commit/cad961bb24d3b1ec63571e8cac6aa8b16245f95b.diff
LOG: [NFC][Asan] Remove from_memalign and rz_log
Before D87643 they where used to optimize UsedSize(). Which was
called frequently from leak scanner.
It was also used for calls from QuarantineCallback
but we have heavy get_allocator().Deallocate call there anyway.
Depends on D87643.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D87644
Added:
Modified:
compiler-rt/lib/asan/asan_allocator.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp
index f43882fcd8be..d136423a3e34 100644
--- a/compiler-rt/lib/asan/asan_allocator.cpp
+++ b/compiler-rt/lib/asan/asan_allocator.cpp
@@ -89,9 +89,7 @@ static const uptr kAllocBegMagic = 0xCC6E96B9;
class ChunkHeader {
public:
atomic_uint8_t chunk_state;
- u8 from_memalign : 1;
u8 alloc_type : 2;
- u8 rz_log : 3;
u8 lsan_tag : 2;
// align < 8 -> 0
@@ -161,12 +159,6 @@ enum {
class AsanChunk : public ChunkBase {
public:
uptr Beg() { return reinterpret_cast<uptr>(this) + kChunkHeaderSize; }
-
- void *AllocBeg() {
- if (from_memalign)
- return get_allocator().GetBlockBegin(reinterpret_cast<void *>(this));
- return reinterpret_cast<void*>(Beg() - RZLog2Size(rz_log));
- }
};
struct QuarantineCallback {
@@ -185,7 +177,7 @@ struct QuarantineCallback {
PoisonShadow(m->Beg(),
RoundUpTo(m->UsedSize(), SHADOW_GRANULARITY),
kAsanHeapLeftRedzoneMagic);
- void *p = reinterpret_cast<void *>(m->AllocBeg());
+ void *p = get_allocator().GetBlockBegin(m);
if (p != m) {
uptr *alloc_magic = reinterpret_cast<uptr *>(p);
CHECK_EQ(alloc_magic[0], kAllocBegMagic);
@@ -541,8 +533,7 @@ struct Allocator {
uptr alloc_beg = reinterpret_cast<uptr>(allocated);
uptr alloc_end = alloc_beg + needed_size;
- uptr beg_plus_redzone = alloc_beg + rz_size;
- uptr user_beg = beg_plus_redzone;
+ uptr user_beg = alloc_beg + rz_size;
if (!IsAligned(user_beg, alignment))
user_beg = RoundUpTo(user_beg, alignment);
uptr user_end = user_beg + size;
@@ -550,8 +541,6 @@ struct Allocator {
uptr chunk_beg = user_beg - kChunkHeaderSize;
AsanChunk *m = reinterpret_cast<AsanChunk *>(chunk_beg);
m->alloc_type = alloc_type;
- m->rz_log = rz_log;
- m->from_memalign = user_beg != beg_plus_redzone;
if (alloc_beg != chunk_beg) {
CHECK_LE(alloc_beg + 2 * sizeof(uptr), chunk_beg);
reinterpret_cast<uptr *>(alloc_beg)[0] = kAllocBegMagic;
More information about the llvm-commits
mailing list