tsan: uninline Enable/DisableIgnores

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
This commit is contained in:
Dmitry Vyukov 2021-09-21 14:13:12 +02:00
parent db2f870fe3
commit 82e593cf90
2 changed files with 28 additions and 18 deletions

View File

@ -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();

View File

@ -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;
}
}