[compiler-rt] r192980 - [asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space
Kostya Serebryany
kcc at google.com
Fri Oct 18 08:07:07 PDT 2013
Author: kcc
Date: Fri Oct 18 10:07:07 2013
New Revision: 192980
URL: http://llvm.org/viewvc/llvm-project?rev=192980&view=rev
Log:
[asan] allocate AsanThreadContext using LowLevelAllocator instead of mmap to save space
Modified:
compiler-rt/trunk/lib/asan/asan_thread.cc
Modified: compiler-rt/trunk/lib/asan/asan_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=192980&r1=192979&r2=192980&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.cc Fri Oct 18 10:07:07 2013
@@ -43,8 +43,12 @@ void AsanThreadContext::OnFinished() {
static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)];
static ThreadRegistry *asan_thread_registry;
+static BlockingMutex mu_for_thread_context(LINKER_INITIALIZED);
+static LowLevelAllocator allocator_for_thread_context;
+
static ThreadContextBase *GetAsanThreadContext(u32 tid) {
- void *mem = MmapOrDie(sizeof(AsanThreadContext), "AsanThreadContext");
+ BlockingMutexLock lock(&mu_for_thread_context);
+ void *mem = allocator_for_thread_context.Allocate(sizeof(AsanThreadContext));
return new(mem) AsanThreadContext(tid);
}
More information about the llvm-commits
mailing list