summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_log_interface.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/xray/xray_log_interface.cc')
-rw-r--r--compiler-rt/lib/xray/xray_log_interface.cc42
1 files changed, 20 insertions, 22 deletions
diff --git a/compiler-rt/lib/xray/xray_log_interface.cc b/compiler-rt/lib/xray/xray_log_interface.cc
index aa3fcc83578..0886fd0d121 100644
--- a/compiler-rt/lib/xray/xray_log_interface.cc
+++ b/compiler-rt/lib/xray/xray_log_interface.cc
@@ -19,7 +19,7 @@
#include "xray_defs.h"
namespace __xray {
-static __sanitizer::SpinMutex XRayImplMutex;
+static SpinMutex XRayImplMutex;
static XRayLogImpl CurrentXRayImpl{nullptr, nullptr, nullptr, nullptr};
static XRayLogImpl *GlobalXRayImpl = nullptr;
@@ -30,7 +30,7 @@ XRayBuffer NullBufferIterator(XRayBuffer) XRAY_NEVER_INSTRUMENT {
}
// This is the global function responsible for iterating through given buffers.
-__sanitizer::atomic_uintptr_t XRayBufferIterator{
+atomic_uintptr_t XRayBufferIterator{
reinterpret_cast<uintptr_t>(&NullBufferIterator)};
// We use a linked list of Mode to XRayLogImpl mappings. This is a linked list
@@ -53,9 +53,8 @@ using namespace __xray;
void __xray_log_set_buffer_iterator(XRayBuffer (*Iterator)(XRayBuffer))
XRAY_NEVER_INSTRUMENT {
- __sanitizer::atomic_store(&__xray::XRayBufferIterator,
- reinterpret_cast<uintptr_t>(Iterator),
- __sanitizer::memory_order_release);
+ atomic_store(&__xray::XRayBufferIterator,
+ reinterpret_cast<uintptr_t>(Iterator), memory_order_release);
}
void __xray_log_remove_buffer_iterator() XRAY_NEVER_INSTRUMENT {
@@ -69,16 +68,15 @@ __xray_log_register_mode(const char *Mode,
Impl.log_finalize == nullptr || Impl.log_init == nullptr)
return XRayLogRegisterStatus::XRAY_INCOMPLETE_IMPL;
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
// First, look for whether the mode already has a registered implementation.
for (ModeImpl *it = ModeImpls; it != &SentinelModeImpl; it = it->Next) {
- if (!__sanitizer::internal_strcmp(Mode, it->Mode))
+ if (!internal_strcmp(Mode, it->Mode))
return XRayLogRegisterStatus::XRAY_DUPLICATE_MODE;
}
- auto *NewModeImpl =
- static_cast<ModeImpl *>(__sanitizer::InternalAlloc(sizeof(ModeImpl)));
+ auto *NewModeImpl = static_cast<ModeImpl *>(InternalAlloc(sizeof(ModeImpl)));
NewModeImpl->Next = ModeImpls;
- NewModeImpl->Mode = __sanitizer::internal_strdup(Mode);
+ NewModeImpl->Mode = internal_strdup(Mode);
NewModeImpl->Impl = Impl;
ModeImpls = NewModeImpl;
return XRayLogRegisterStatus::XRAY_REGISTRATION_OK;
@@ -86,9 +84,9 @@ __xray_log_register_mode(const char *Mode,
XRayLogRegisterStatus
__xray_log_select_mode(const char *Mode) XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
for (ModeImpl *it = ModeImpls; it != &SentinelModeImpl; it = it->Next) {
- if (!__sanitizer::internal_strcmp(Mode, it->Mode)) {
+ if (!internal_strcmp(Mode, it->Mode)) {
CurrentMode = it;
CurrentXRayImpl = it->Impl;
GlobalXRayImpl = &CurrentXRayImpl;
@@ -100,7 +98,7 @@ __xray_log_select_mode(const char *Mode) XRAY_NEVER_INSTRUMENT {
}
const char *__xray_log_get_current_mode() XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (CurrentMode != nullptr)
return CurrentMode->Mode;
return nullptr;
@@ -109,7 +107,7 @@ const char *__xray_log_get_current_mode() XRAY_NEVER_INSTRUMENT {
void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {
if (Impl.log_init == nullptr || Impl.log_finalize == nullptr ||
Impl.handle_arg0 == nullptr || Impl.flush_log == nullptr) {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
GlobalXRayImpl = nullptr;
CurrentMode = nullptr;
__xray_remove_handler();
@@ -117,14 +115,14 @@ void __xray_set_log_impl(XRayLogImpl Impl) XRAY_NEVER_INSTRUMENT {
return;
}
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
CurrentXRayImpl = Impl;
GlobalXRayImpl = &CurrentXRayImpl;
__xray_set_handler(Impl.handle_arg0);
}
void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
GlobalXRayImpl = nullptr;
__xray_remove_handler();
__xray_remove_handler_arg1();
@@ -133,7 +131,7 @@ void __xray_remove_log_impl() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
void *Args,
size_t ArgsSize) XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (!GlobalXRayImpl)
return XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
return GlobalXRayImpl->log_init(BufferSize, MaxBuffers, Args, ArgsSize);
@@ -141,7 +139,7 @@ XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,
XRayLogInitStatus __xray_log_init_mode(const char *Mode, const char *Config)
XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (!GlobalXRayImpl)
return XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
@@ -162,7 +160,7 @@ XRayLogInitStatus __xray_log_init_mode(const char *Mode, const char *Config)
XRayLogInitStatus
__xray_log_init_mode_bin(const char *Mode, const char *Config,
size_t ConfigSize) XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (!GlobalXRayImpl)
return XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
@@ -181,14 +179,14 @@ __xray_log_init_mode_bin(const char *Mode, const char *Config,
}
XRayLogInitStatus __xray_log_finalize() XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (!GlobalXRayImpl)
return XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
return GlobalXRayImpl->log_finalize();
}
XRayLogFlushStatus __xray_log_flushLog() XRAY_NEVER_INSTRUMENT {
- __sanitizer::SpinMutexLock Guard(&XRayImplMutex);
+ SpinMutexLock Guard(&XRayImplMutex);
if (!GlobalXRayImpl)
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
return GlobalXRayImpl->flush_log();
@@ -201,7 +199,7 @@ XRayLogFlushStatus __xray_log_process_buffers(
if (!GlobalXRayImpl)
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
auto Iterator = reinterpret_cast<XRayBuffer (*)(XRayBuffer)>(
- atomic_load(&XRayBufferIterator, __sanitizer::memory_order_acquire));
+ atomic_load(&XRayBufferIterator, memory_order_acquire));
auto Buffer = (*Iterator)(XRayBuffer{nullptr, 0});
auto Mode = CurrentMode ? CurrentMode->Mode : nullptr;
while (Buffer.Data != nullptr) {
OpenPOWER on IntegriCloud