llvm-project/compiler-rt/lib/scudo
Dan Liew 41fec1bfc5 Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`.
Summary:
This is a follow up patch to r346956 for the `SizeClassAllocator32`
allocator.

This patch makes `AddressSpaceView` a template parameter both to the
`ByteMap` implementations (but makes `LocalAddressSpaceView` the
default), some `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.

For ASan and LSan we make `AP32` and `ByteMap` templateds type that take
a single `AddressSpaceView` argument. This has been done because we will
instantiate the allocator with a type that isn't `LocalAddressSpaceView`
in the future patches. For the allocators used in the other sanitizers
(i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is
hard coded because we do not intend to instantiate the allocators with
any other type.

In the cases where untemplated types have become templated on a single
`AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has
been changed to have a `ASVT` suffix (Address Space View Type) to
indicate they are templated.  The only exception to this are the `AP32`
types due to the desire to keep the type name as short as possible.

In order to check that template is instantiated in the correct a way a
`static_assert(...)` has been added that checks that the
`AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches
the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h`
header.

rdar://problem/45284065

Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov

Subscribers: mgorny, llvm-commits, #sanitizers

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

llvm-svn: 349138
2018-12-14 09:03:18 +00:00
..
CMakeLists.txt [sanitizer] Use -Wl,-z,global on Android for sanitizers except UBsan 2018-10-02 16:19:42 +00:00
scudo_allocator.cpp [scudo] Replace eraseHeader with compareExchangeHeader for Quarantined chunks 2018-08-24 18:21:32 +00:00
scudo_allocator.h Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`. 2018-12-14 09:03:18 +00:00
scudo_allocator_combined.h [scudo] Simplify internal names (NFC) 2018-07-20 15:07:17 +00:00
scudo_allocator_secondary.h [sanitizer] Revert D50940 2018-08-29 19:41:28 +00:00
scudo_crc32.cpp [scudo] CRC32 optimizations 2017-05-09 15:12:38 +00:00
scudo_crc32.h [sanitizer] Add Scudo to the sanitizer lint checks. 2017-11-08 16:42:29 +00:00
scudo_errors.cpp [scudo] Add verbose failures in place of CHECK(0) 2018-06-15 16:45:19 +00:00
scudo_errors.h [scudo] Add verbose failures in place of CHECK(0) 2018-06-15 16:45:19 +00:00
scudo_flags.cpp [scudo] Allow options to be defined at compile time 2018-02-08 16:29:48 +00:00
scudo_flags.h [scudo] 32-bit and hardware agnostic support 2016-11-30 17:32:20 +00:00
scudo_flags.inc [scudo] Quarantine overhaul 2017-07-24 15:29:38 +00:00
scudo_interface_internal.h [scudo] Adding an interface function to print allocator stats 2018-04-25 18:52:29 +00:00
scudo_malloc.cpp [sanitizer] Fix mallopt interceptor. 2018-10-25 22:15:44 +00:00
scudo_new_delete.cpp [scudo] Add verbose failures in place of CHECK(0) 2018-06-15 16:45:19 +00:00
scudo_platform.h [scudo] Enable Scudo memory hooks for Fuchsia. 2018-07-02 19:48:01 +00:00
scudo_termination.cpp [scudo] Make logging more consistent 2018-03-07 16:22:16 +00:00
scudo_tsd.h [scudo] Simplify internal names (NFC) 2018-07-20 15:07:17 +00:00
scudo_tsd_exclusive.cpp [scudo] Improve the scalability of the shared TSD model 2018-06-11 14:50:31 +00:00
scudo_tsd_exclusive.inc [scudo] Improve the scalability of the shared TSD model 2018-06-11 14:50:31 +00:00
scudo_tsd_shared.cpp [scudo] Improve the scalability of the shared TSD model 2018-06-11 14:50:31 +00:00
scudo_tsd_shared.inc [scudo] Improve the scalability of the shared TSD model 2018-06-11 14:50:31 +00:00
scudo_utils.cpp [scudo] Add some logs for Android 2018-07-06 16:50:12 +00:00
scudo_utils.h [scudo] Minor code generation improvement 2017-12-08 16:36:37 +00:00