[PATCH] D48142: [Sanitizers] Make sanitizer allocator linker-initialize compliant.

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 14:49:33 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334660: [Sanitizers] Make sanitizer allocator linker-initialize compliant. (authored by alekseyshl, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48142

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_stats.h
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_quarantine.h
@@ -90,6 +90,9 @@
     atomic_store_relaxed(&max_size_, size);
     atomic_store_relaxed(&min_size_, size / 10 * 9);  // 90% of max size.
     atomic_store_relaxed(&max_cache_size_, cache_size);
+
+    cache_mutex_.Init();
+    recycle_mutex_.Init();
   }
 
   uptr GetSize() const { return atomic_load_relaxed(&max_size_); }
@@ -142,8 +145,8 @@
   atomic_uintptr_t min_size_;
   atomic_uintptr_t max_cache_size_;
   char pad1_[kCacheLineSize];
-  SpinMutex cache_mutex_;
-  SpinMutex recycle_mutex_;
+  StaticSpinMutex cache_mutex_;
+  StaticSpinMutex recycle_mutex_;
   Cache cache_;
   char pad2_[kCacheLineSize];
 
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_stats.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_stats.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_stats.h
@@ -101,7 +101,7 @@
   }
 
  private:
-  mutable SpinMutex mu_;
+  mutable StaticSpinMutex mu_;
 };
 
 
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_secondary.h
@@ -314,6 +314,6 @@
   struct Stats {
     uptr n_allocs, n_frees, currently_allocated, max_allocated, by_size_log[64];
   } stats;
-  SpinMutex mutex_;
+  StaticSpinMutex mutex_;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48142.151252.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180613/ecb25b25/attachment.bin>


More information about the llvm-commits mailing list