[llvm-commits] [compiler-rt] r160347 - in /compiler-rt/trunk/lib/asan: asan_rtl.cc asan_thread.cc asan_thread.h
Kostya Serebryany
kcc at google.com
Tue Jul 17 00:20:13 PDT 2012
Author: kcc
Date: Tue Jul 17 02:20:13 2012
New Revision: 160347
URL: http://llvm.org/viewvc/llvm-project?rev=160347&view=rev
Log:
[asan] get rid of the last operator new call in asan rtl
Modified:
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/asan/asan_thread.cc
compiler-rt/trunk/lib/asan/asan_thread.h
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=160347&r1=160346&r2=160347&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Jul 17 02:20:13 2012
@@ -48,7 +48,7 @@
}
void CheckFailed(const char *file, int line, const char *cond, u64 v1, u64 v2) {
- AsanReport("AddressSanitizer CHECK failed: %s:%d \"%s\" (%zx, %zx)\n",
+ AsanReport("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n",
file, line, cond, (uptr)v1, (uptr)v2);
PRINT_CURRENT_STACK();
ShowStatsAndAbort();
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=160347&r1=160346&r2=160347&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.cc Tue Jul 17 02:20:13 2012
@@ -26,6 +26,9 @@
malloc_storage_(x),
stats_(x) { }
+static AsanLock mu_for_thread_summary(LINKER_INITIALIZED);
+static LowLevelAllocator allocator_for_thread_summary(LINKER_INITIALIZED);
+
AsanThread *AsanThread::Create(u32 parent_tid, thread_callback_t start_routine,
void *arg, AsanStackTrace *stack) {
uptr size = RoundUpTo(sizeof(AsanThread), kPageSize);
@@ -33,7 +36,15 @@
thread->start_routine_ = start_routine;
thread->arg_ = arg;
- AsanThreadSummary *summary = new AsanThreadSummary(parent_tid, stack);
+ const uptr kSummaryAllocSize = 1024;
+ CHECK_LE(sizeof(AsanThreadSummary), kSummaryAllocSize);
+ AsanThreadSummary *summary;
+ {
+ ScopedLock lock(&mu_for_thread_summary);
+ summary = (AsanThreadSummary*)
+ allocator_for_thread_summary.Allocate(kSummaryAllocSize);
+ }
+ summary->Init(parent_tid, stack);
summary->set_thread(thread);
thread->set_summary(summary);
Modified: compiler-rt/trunk/lib/asan/asan_thread.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=160347&r1=160346&r2=160347&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.h (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.h Tue Jul 17 02:20:13 2012
@@ -18,6 +18,7 @@
#include "asan_internal.h"
#include "asan_stack.h"
#include "asan_stats.h"
+#include "sanitizer_common/sanitizer_libc.h"
namespace __asan {
@@ -30,12 +31,12 @@
class AsanThreadSummary {
public:
explicit AsanThreadSummary(LinkerInitialized) { } // for T0.
- AsanThreadSummary(u32 parent_tid, AsanStackTrace *stack)
- : parent_tid_(parent_tid),
- announced_(false) {
+ void Init(u32 parent_tid, AsanStackTrace *stack) {
+ parent_tid_ = parent_tid;
+ announced_ = false;
tid_ = kInvalidTid;
if (stack) {
- stack_ = *stack;
+ internal_memcpy(&stack_, stack, sizeof(*stack));
}
thread_ = 0;
}
More information about the llvm-commits
mailing list