[scudo] Add Chunk::getSize, rework Chunk::getUsableSize
authorKostya Kortchinsky <kostyak@google.com>
Wed, 14 Mar 2018 15:50:32 +0000 (15:50 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Wed, 14 Mar 2018 15:50:32 +0000 (15:50 +0000)
commita51139046e0442356a336304257752474232af52
tree5a90ee641a28897de57eba5d18ac6af4aaf533f3
parentd1c3c995c05fcd9c50f79ef0ef001f1439f51cc1
[scudo] Add Chunk::getSize, rework Chunk::getUsableSize

Summary:
Using `getActuallyAllocatedSize` from the Combined resulting in mediocre
compiled code, as the `ClassId != 0` predicament was not propagated there,
resulting in additional branches and dead code. Move the logic in the frontend,
which results in better compiled code. Also I think it makes it slightly easier
to distinguish between the size the user requested, and the size that was
actually allocated by the allocator.

`const` a couple of things as well.

This has no functional impact.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D44444

llvm-svn: 327525
compiler-rt/lib/scudo/scudo_allocator.cpp
compiler-rt/lib/scudo/scudo_allocator_combined.h