[compiler-rt] r321782 - [tsan] Separate the constants in libignore and bump the maximum for instrumented libraries

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 18:28:51 PST 2018


Author: kuba.brecka
Date: Wed Jan  3 18:28:51 2018
New Revision: 321782

URL: http://llvm.org/viewvc/llvm-project?rev=321782&view=rev
Log:
[tsan] Separate the constants in libignore and bump the maximum for instrumented libraries

We're having some use cases where we have more than 128 (the current maximum) instrumented dynamic libraries loaded into a single process. Let's bump the limit to 1024, and separate the constants.

Differential Revision: https://reviews.llvm.org/D41190


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.h

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc?rev=321782&r1=321781&r2=321782&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.cc Wed Jan  3 18:28:51 2018
@@ -80,7 +80,7 @@ void LibIgnore::OnLibraryLoaded(const ch
         lib->name = internal_strdup(mod.full_name());
         const uptr idx =
             atomic_load(&ignored_ranges_count_, memory_order_relaxed);
-        CHECK_LT(idx, kMaxLibs);
+        CHECK_LT(idx, ARRAY_SIZE(ignored_code_ranges_));
         ignored_code_ranges_[idx].begin = range.beg;
         ignored_code_ranges_[idx].end = range.end;
         atomic_store(&ignored_ranges_count_, idx + 1, memory_order_release);
@@ -109,7 +109,7 @@ void LibIgnore::OnLibraryLoaded(const ch
                 range.beg, range.end, mod.full_name());
         const uptr idx =
             atomic_load(&instrumented_ranges_count_, memory_order_relaxed);
-        CHECK_LT(idx, kMaxLibs);
+        CHECK_LT(idx, ARRAY_SIZE(instrumented_code_ranges_));
         instrumented_code_ranges_[idx].begin = range.beg;
         instrumented_code_ranges_[idx].end = range.end;
         atomic_store(&instrumented_ranges_count_, idx + 1,

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.h?rev=321782&r1=321781&r2=321782&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libignore.h Wed Jan  3 18:28:51 2018
@@ -66,14 +66,16 @@ class LibIgnore {
     return (pc >= range.begin && pc < range.end);
   }
 
-  static const uptr kMaxLibs = 128;
+  static const uptr kMaxIgnoredRanges = 128;
+  static const uptr kMaxInstrumentedRanges = 1024;
+  static const uptr kMaxLibs = 1024;
 
   // Hot part:
   atomic_uintptr_t ignored_ranges_count_;
-  LibCodeRange ignored_code_ranges_[kMaxLibs];
+  LibCodeRange ignored_code_ranges_[kMaxIgnoredRanges];
 
   atomic_uintptr_t instrumented_ranges_count_;
-  LibCodeRange instrumented_code_ranges_[kMaxLibs];
+  LibCodeRange instrumented_code_ranges_[kMaxInstrumentedRanges];
 
   // Cold part:
   BlockingMutex mutex_;




More information about the llvm-commits mailing list