Skip to content

Commit

Permalink
tsan: uninline Enable/DisableIgnores
Browse files Browse the repository at this point in the history
ScopedInterceptor::Enable/DisableIgnores is only used for some special cases.
Unline them from the common interceptor handling.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D110157
  • Loading branch information
dvyukov committed Sep 22, 2021
1 parent db2f870 commit 82e593c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
14 changes: 12 additions & 2 deletions compiler-rt/lib/tsan/rtl/tsan_interceptors.h
Expand Up @@ -10,12 +10,22 @@ class ScopedInterceptor {
public:
ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc);
~ScopedInterceptor();
void DisableIgnores();
void EnableIgnores();
void DisableIgnores() {
if (UNLIKELY(ignoring_))
DisableIgnoresImpl();
}
void EnableIgnores() {
if (UNLIKELY(ignoring_))
EnableIgnoresImpl();
}

private:
ThreadState *const thr_;
bool in_ignored_lib_;
bool ignoring_;

void DisableIgnoresImpl();
void EnableIgnoresImpl();
};

LibIgnore *libignore();
Expand Down
32 changes: 16 additions & 16 deletions compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Expand Up @@ -264,25 +264,25 @@ ScopedInterceptor::~ScopedInterceptor() {
}
}

void ScopedInterceptor::EnableIgnores() {
if (ignoring_) {
ThreadIgnoreBegin(thr_, 0);
if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports++;
if (in_ignored_lib_) {
DCHECK(!thr_->in_ignored_lib);
thr_->in_ignored_lib = true;
}
NOINLINE
void ScopedInterceptor::EnableIgnoresImpl() {
ThreadIgnoreBegin(thr_, 0);
if (flags()->ignore_noninstrumented_modules)
thr_->suppress_reports++;
if (in_ignored_lib_) {
DCHECK(!thr_->in_ignored_lib);
thr_->in_ignored_lib = true;
}
}

void ScopedInterceptor::DisableIgnores() {
if (ignoring_) {
ThreadIgnoreEnd(thr_);
if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports--;
if (in_ignored_lib_) {
DCHECK(thr_->in_ignored_lib);
thr_->in_ignored_lib = false;
}
NOINLINE
void ScopedInterceptor::DisableIgnoresImpl() {
ThreadIgnoreEnd(thr_);
if (flags()->ignore_noninstrumented_modules)
thr_->suppress_reports--;
if (in_ignored_lib_) {
DCHECK(thr_->in_ignored_lib);
thr_->in_ignored_lib = false;
}
}

Expand Down

0 comments on commit 82e593c

Please sign in to comment.