[PATCH] D37612: [XRay][compiler-rt] Use a single global volatile recursion guard for FDR handlers
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 18:39:31 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL312992: [XRay][compiler-rt] Use a single global volatile recursion guard for FDR… (authored by dberris).
Repository:
rL LLVM
https://reviews.llvm.org/D37612
Files:
compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
Index: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
@@ -42,7 +42,7 @@
// NOTE: This is a pointer to avoid having to do atomic operations at
// initialization time. This is OK to leak as there will only be one bufferqueue
// for the runtime, initialized once through the fdrInit(...) sequence.
-std::shared_ptr<BufferQueue>* BQ = nullptr;
+std::shared_ptr<BufferQueue> *BQ = nullptr;
__sanitizer::atomic_sint32_t LogFlushStatus = {
XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING};
@@ -207,7 +207,6 @@
auto TSC_CPU = getTimestamp();
auto &TSC = std::get<0>(TSC_CPU);
auto &CPU = std::get<1>(TSC_CPU);
- thread_local bool Running = false;
RecursionGuard Guard{Running};
if (!Guard) {
assert(Running && "RecursionGuard is buggy!");
@@ -298,7 +297,9 @@
using namespace __xray;
if (flags()->xray_fdr_log) {
XRayLogImpl Impl{
- fdrLoggingInit, fdrLoggingFinalize, fdrLoggingHandleArg0,
+ fdrLoggingInit,
+ fdrLoggingFinalize,
+ fdrLoggingHandleArg0,
fdrLoggingFlush,
};
__xray_set_log_impl(Impl);
Index: compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
===================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
@@ -571,6 +571,8 @@
}
}
+thread_local volatile bool Running = false;
+
inline void processFunctionHook(
int32_t FuncId, XRayEntryType Entry, uint64_t TSC, unsigned char CPU,
int (*wall_clock_reader)(clockid_t, struct timespec *),
@@ -581,7 +583,6 @@
// don't want to be clobbering potentially partial writes already happening in
// the thread. We use a simple thread_local latch to only allow one on-going
// handleArg0 to happen at any given time.
- thread_local volatile bool Running = false;
RecursionGuard Guard{Running};
if (!Guard) {
assert(Running == true && "RecursionGuard is buggy!");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37612.114749.patch
Type: text/x-patch
Size: 2116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/697d2ef6/attachment.bin>
More information about the llvm-commits
mailing list