forked from OSchip/llvm-project
[ASan] Remove an unused ChunkBase field
Also fix wrong alignment maths and an outdated comment llvm-svn: 182238
This commit is contained in:
parent
d0e34a200f
commit
667cae7b69
|
@ -174,7 +174,6 @@ struct ChunkHeader {
|
||||||
|
|
||||||
struct ChunkBase : ChunkHeader {
|
struct ChunkBase : ChunkHeader {
|
||||||
// Header2, intersects with user memory.
|
// Header2, intersects with user memory.
|
||||||
AsanChunk *next;
|
|
||||||
u32 free_context_id;
|
u32 free_context_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,7 +194,8 @@ struct AsanChunk: ChunkBase {
|
||||||
return allocator.GetBlockBegin(reinterpret_cast<void *>(this));
|
return allocator.GetBlockBegin(reinterpret_cast<void *>(this));
|
||||||
return reinterpret_cast<void*>(Beg() - RZLog2Size(rz_log));
|
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() {
|
u32 *AllocStackBeg() {
|
||||||
return (u32*)(Beg() - RZLog2Size(rz_log));
|
return (u32*)(Beg() - RZLog2Size(rz_log));
|
||||||
}
|
}
|
||||||
|
@ -322,9 +322,7 @@ static void *Allocate(uptr size, uptr alignment, StackTrace *stack,
|
||||||
CHECK(IsPowerOfTwo(alignment));
|
CHECK(IsPowerOfTwo(alignment));
|
||||||
uptr rz_log = ComputeRZLog(size);
|
uptr rz_log = ComputeRZLog(size);
|
||||||
uptr rz_size = RZLog2Size(rz_log);
|
uptr rz_size = RZLog2Size(rz_log);
|
||||||
uptr rounded_size = RoundUpTo(size, alignment);
|
uptr rounded_size = RoundUpTo(Max(size, kChunkHeader2Size), alignment);
|
||||||
if (rounded_size < kChunkHeader2Size)
|
|
||||||
rounded_size = kChunkHeader2Size;
|
|
||||||
uptr needed_size = rounded_size + rz_size;
|
uptr needed_size = rounded_size + rz_size;
|
||||||
if (alignment > min_alignment)
|
if (alignment > min_alignment)
|
||||||
needed_size += alignment;
|
needed_size += alignment;
|
||||||
|
|
Loading…
Reference in New Issue