[PATCH] D54904: Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 26 08:57:09 PST 2018


delcypher created this revision.
delcypher added reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov.
Herald added subscribers: Sanitizers, llvm-commits, mgorny.

This is a follow up patch to r346956 for the `SizeClassAllocator32`
allocator.

This patch makes `AddressSpaceView` a template parameter both to the
`ByteMap` implementations, `AP32` implementations and is used in
`SizeClassAllocator32`. The actual changes to `ByteMap` implementations
and `SizeClassAllocator32` are very simple. However the patch is large
because it requires changing all the `AP32` definitions, and users of
those definitions.

Note that the reason for not making `LocalAddressSpaceView` the default
template parameter for the various templates is because that would
require all users to add empty braces (i.e. `PrimaryAllocator<>` instead
of `PrimaryAllocator` to instantiate).  To avoid this we create a
template version with a `T` suffix (e.g.  `PrimaryAllocatorT`) and then
create an alias that has the previous type name (e.g.
`PrimaryAllocator`) that instantiates with `LocalAddressSpaceView` (e.g.
`PrimaryAllocatorT<LocalAddressSpaceView>`).

In order to check that template is instantiated in the correct a way a
`static_assert(...)` has been added that relies of being able to check
types are equal. To this a new `sanitizer_type_traits.h` header has been
added which implements a small subset of the C++ `type_traits` header.
Tests have been added for the new type traits header file.

rdar://problem/45284065


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54904

Files:
  lib/asan/asan_allocator.h
  lib/hwasan/hwasan_allocator.h
  lib/lsan/lsan_allocator.h
  lib/msan/msan_allocator.cc
  lib/sanitizer_common/sanitizer_allocator.h
  lib/sanitizer_common/sanitizer_allocator_bytemap.h
  lib/sanitizer_common/sanitizer_allocator_internal.h
  lib/sanitizer_common/sanitizer_allocator_primary32.h
  lib/sanitizer_common/sanitizer_type_traits.h
  lib/sanitizer_common/tests/CMakeLists.txt
  lib/sanitizer_common/tests/sanitizer_allocator_test.cc
  lib/sanitizer_common/tests/sanitizer_type_traits_test.cc
  lib/scudo/scudo_allocator.h
  lib/tsan/rtl/tsan_rtl.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54904.175280.patch
Type: text/x-patch
Size: 23295 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181126/ece77abf/attachment.bin>


More information about the llvm-commits mailing list