forked from OSchip/llvm-project
26e81209ef
Summary: This change is part of the larger XRay Profiling Mode effort. Here we implement an arena allocator, for fixed sized buffers used in a segmented array implementation. This change adds the segmented array data structure, which relies on the allocator to provide and maintain the storage for the segmented array. Key features of the `Allocator` type: * It uses cache-aligned blocks, intended to host the actual data. These blocks are cache-line-size multiples of contiguous bytes. * The `Allocator` has a maximum memory budget, set at construction time. This allows us to cap the amount of data each specific `Allocator` instance is responsible for. * Upon destruction, the `Allocator` will clean up the storage it's used, handing it back to the internal allocator used in sanitizer_common. Key features of the `Array` type: * Each segmented array is always backed by an `Allocator`, which is either user-provided or uses a global allocator. * When an `Array` grows, it grows by appending a segment that's fixed-sized. The size of each segment is computed by the number of elements of type `T` that can fit into cache line multiples. * An `Array` does not return memory to the `Allocator`, but it can keep track of the current number of "live" objects it stores. * When an `Array` is destroyed, it will not return memory to the `Allocator`. Users should clean up the `Allocator` independently of the `Array`. * The `Array` type keeps a freelist of the chunks it's used before, so that trimming and growing will re-use previously allocated chunks. These basic data structures are used by the XRay Profiling Mode implementation to implement efficient and cache-aware storage for data that's typically read-and-write heavy for tracking latency information. We're relying on the cache line characteristics of the architecture to provide us good data isolation and cache friendliness, when we're performing operations like searching for elements and/or updating data hosted in these cache lines. Reviewers: echristo, pelikan, kpw Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D45756 llvm-svn: 331141 |
||
---|---|---|
.. | ||
tests | ||
CMakeLists.txt | ||
weak_symbols.txt | ||
xray_AArch64.cc | ||
xray_allocator.h | ||
xray_always_instrument.txt | ||
xray_arm.cc | ||
xray_buffer_queue.cc | ||
xray_buffer_queue.h | ||
xray_defs.h | ||
xray_fdr_log_records.h | ||
xray_fdr_logging.cc | ||
xray_fdr_logging.h | ||
xray_fdr_logging_impl.h | ||
xray_flags.cc | ||
xray_flags.h | ||
xray_flags.inc | ||
xray_init.cc | ||
xray_inmemory_log.cc | ||
xray_inmemory_log.h | ||
xray_interface.cc | ||
xray_interface_internal.h | ||
xray_log_interface.cc | ||
xray_mips.cc | ||
xray_mips64.cc | ||
xray_never_instrument.txt | ||
xray_powerpc64.cc | ||
xray_powerpc64.inc | ||
xray_segmented_array.h | ||
xray_trampoline_AArch64.S | ||
xray_trampoline_arm.S | ||
xray_trampoline_mips.S | ||
xray_trampoline_mips64.S | ||
xray_trampoline_powerpc64.cc | ||
xray_trampoline_powerpc64_asm.S | ||
xray_trampoline_x86_64.S | ||
xray_tsc.h | ||
xray_utils.cc | ||
xray_utils.h | ||
xray_x86_64.cc | ||
xray_x86_64.inc |