[PATCH] Remove an unused ChunkBase field
Timur Iskhodzhanov
timurrrr at google.com
Sat May 18 06:14:32 PDT 2013
Hi kcc,
Also fix wrong alignment maths and an outdated comment
http://llvm-reviews.chandlerc.com/D817
Files:
asan/asan_allocator2.cc
Index: asan/asan_allocator2.cc
===================================================================
--- asan/asan_allocator2.cc
+++ asan/asan_allocator2.cc
@@ -170,7 +170,6 @@
struct ChunkBase : ChunkHeader {
// Header2, intersects with user memory.
- AsanChunk *next;
u32 free_context_id;
};
@@ -191,7 +190,8 @@
return allocator.GetBlockBegin(reinterpret_cast<void *>(this));
return reinterpret_cast<void*>(Beg() - RZLog2Size(rz_log));
}
- // We store the alloc/free stack traces in the chunk itself.
+ // If we don't use stack depot, we store the alloc/free stack traces
+ // in the chunk itself.
u32 *AllocStackBeg() {
return (u32*)(Beg() - RZLog2Size(rz_log));
}
@@ -318,9 +318,7 @@
CHECK(IsPowerOfTwo(alignment));
uptr rz_log = ComputeRZLog(size);
uptr rz_size = RZLog2Size(rz_log);
- uptr rounded_size = RoundUpTo(size, alignment);
- if (rounded_size < kChunkHeader2Size)
- rounded_size = kChunkHeader2Size;
+ uptr rounded_size = RoundUpTo(Max(size, kChunkHeader2Size), alignment);
uptr needed_size = rounded_size + rz_size;
if (alignment > min_alignment)
needed_size += alignment;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D817.1.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130518/0ea7868f/attachment.bin>
More information about the llvm-commits
mailing list