[scudo][standalone] Introduce the thread specific data structures
authorKostya Kortchinsky <kostyak@google.com>
Mon, 10 Jun 2019 16:50:52 +0000 (16:50 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Mon, 10 Jun 2019 16:50:52 +0000 (16:50 +0000)
commit52bfd673d1553c4722db2612c99f03eb227a480d
tree5d39cf04abaa1c868e1083267a2dd700c75cc7a1
parent9aff1ddc14f31af7f8b5a275246df574b969f8ec
[scudo][standalone] Introduce the thread specific data structures

Summary:
This CL adds the structures dealing with thread specific data for the
allocator. This includes the thread specific data structure itself and
two registries for said structures: an exclusive one, where each thread
will have its own TSD struct, and a shared one, where a pool of TSD
structs will be shared by all threads, with dynamic reassignment at
runtime based on contention.

This departs from the current Scudo implementation: we intend to make
the Registry a template parameter of the allocator (as opposed to a
single global entity), allowing various allocators to coexist with
different TSD registry models. As a result, TSD registry and Allocator
are tightly coupled.

This also corrects a couple of things in other files that I noticed
while adding this.

Reviewers: eugenis, vitalybuka, morehouse, hctim

Reviewed By: morehouse

Subscribers: srhines, mgorny, delcypher, jfb, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 362962
compiler-rt/lib/scudo/standalone/CMakeLists.txt
compiler-rt/lib/scudo/standalone/internal_defs.h
compiler-rt/lib/scudo/standalone/mutex.h
compiler-rt/lib/scudo/standalone/quarantine.h
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/primary_test.cc
compiler-rt/lib/scudo/standalone/tests/tsd_test.cc [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/tsd.h [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/tsd_exclusive.h [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/tsd_shared.h [new file with mode: 0644]