[PATCH] D32242: [scudo] Minor changes and refactoring

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 13:45:24 PDT 2017


cryptoad created this revision.

This is part of https://reviews.llvm.org/D31947 that is being split into several smaller changes.

This one deals with all the minor changes, more specifically:

- Rename some variables and functions to make their purpose clearer;
- Reorder some code;
- Mark the hot termination incurring checks as `UNLIKELY`; if they happen, the program will die anyway;
- Add a `getScudoChunk` method;
- Add an `eraseHeader` method to ScudoChunk that will clear a header with 0s;
- Add a parameter to `allocate` to know if the allocated chunk should be filled with zeros. This allows `calloc` to not have to call `GetActuallyAllocatedSize`; more changes to get rid of this function on the hot paths will follow;
- reallocate was missing a check to verify that the pointer is properly aligned on `MinAlignment`;
- The `Stats` in the secondary have to be protected by a mutex as the `Add` and `Sub` methods are actually not atomic;
- The software CRC32 function was moved to the header to allow for inlining.


https://reviews.llvm.org/D32242

Files:
  lib/scudo/scudo_allocator.cpp
  lib/scudo/scudo_allocator.h
  lib/scudo/scudo_allocator_secondary.h
  lib/scudo/scudo_utils.cpp
  lib/scudo/scudo_utils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32242.95810.patch
Type: text/x-patch
Size: 27749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/1bfee0f8/attachment-0001.bin>


More information about the llvm-commits mailing list