diff options
| author | Dean Michael Berris <dberris@google.com> | 2017-10-04 05:20:13 +0000 |
|---|---|---|
| committer | Dean Michael Berris <dberris@google.com> | 2017-10-04 05:20:13 +0000 |
| commit | d06e917b9e640bd9b0f20c24f80b03266fe1010b (patch) | |
| tree | 5140b48da908fa45dfc8cd131d3b9727a5ece0a2 /llvm/lib/Support/Parallel.cpp | |
| parent | e14145dcb0070ba1dc743419c6d3ade07893875d (diff) | |
| download | llvm-d06e917b9e640bd9b0f20c24f80b03266fe1010b.zip llvm-d06e917b9e640bd9b0f20c24f80b03266fe1010b.tar.gz llvm-d06e917b9e640bd9b0f20c24f80b03266fe1010b.tar.bz2 | |
[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue
Summary:
This change removes the dependency on using a std::deque<...> for the
storage of the buffers in the buffer queue. We instead implement a
fixed-size circular buffer that's resilient to exhaustion, and preserves
the semantics of the BufferQueue.
We're moving away from using std::deque<...> for two reasons:
- We want to remove dependencies on the STL for data structures.
- We want the data structure we use to not require re-allocation in
the normal course of operation.
The internal implementation of the buffer queue uses heap-allocated
arrays that are initialized once when the BufferQueue is created, and
re-uses slots in the buffer array as buffers are returned in order.
We also change the lock used in the implementation to a spinlock
instead of a blocking mutex. We reason that since the release operations
now take very little time in the critical section, that a spinlock would
be appropriate.
This change is related to D38073.
This change is a re-submit with the following changes:
- Keeping track of the live buffers with a counter independent of the
pointers keeping track of the extents of the circular buffer.
- Additional documentation of what the data members are meant to
represent.
Reviewers: dblaikie, kpw, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38119
llvm-svn: 314877
Diffstat (limited to 'llvm/lib/Support/Parallel.cpp')
0 files changed, 0 insertions, 0 deletions
