forked from OSchip/llvm-project
[ASan] change interface of GetAccumulatedStats() function to prevent Clang from inserting memcpy() call into runtime.
llvm-svn: 168305
This commit is contained in:
parent
b54ac2193f
commit
06b22c1513
|
@ -56,7 +56,8 @@ void AsanStats::Print() {
|
|||
static AsanLock print_lock(LINKER_INITIALIZED);
|
||||
|
||||
static void PrintAccumulatedStats() {
|
||||
AsanStats stats = asanThreadRegistry().GetAccumulatedStats();
|
||||
AsanStats stats;
|
||||
asanThreadRegistry().GetAccumulatedStats(&stats);
|
||||
// Use lock to keep reports from mixing up.
|
||||
ScopedLock lock(&print_lock);
|
||||
stats.Print();
|
||||
|
|
|
@ -104,10 +104,10 @@ AsanStats &AsanThreadRegistry::GetCurrentThreadStats() {
|
|||
return (t) ? t->stats() : main_thread_.stats();
|
||||
}
|
||||
|
||||
AsanStats AsanThreadRegistry::GetAccumulatedStats() {
|
||||
void AsanThreadRegistry::GetAccumulatedStats(AsanStats *stats) {
|
||||
ScopedLock lock(&mu_);
|
||||
UpdateAccumulatedStatsUnlocked();
|
||||
return accumulated_stats_;
|
||||
internal_memcpy(stats, &accumulated_stats_, sizeof(accumulated_stats_));
|
||||
}
|
||||
|
||||
uptr AsanThreadRegistry::GetCurrentAllocatedBytes() {
|
||||
|
|
|
@ -47,9 +47,9 @@ class AsanThreadRegistry {
|
|||
// Returns stats for GetCurrent(), or stats for
|
||||
// T0 if GetCurrent() returns 0.
|
||||
AsanStats &GetCurrentThreadStats();
|
||||
// Flushes all thread-local stats to accumulated stats, and returns
|
||||
// Flushes all thread-local stats to accumulated stats, and makes
|
||||
// a copy of accumulated stats.
|
||||
AsanStats GetAccumulatedStats();
|
||||
void GetAccumulatedStats(AsanStats *stats);
|
||||
uptr GetCurrentAllocatedBytes();
|
||||
uptr GetHeapSize();
|
||||
uptr GetFreeBytes();
|
||||
|
|
Loading…
Reference in New Issue