Avoid calling SizeClassMap::MaxCachedHint on hot path, it's not free.
authorAlex Shlyapnikov <alekseys@google.com>
Wed, 12 Apr 2017 20:51:42 +0000 (20:51 +0000)
committerAlex Shlyapnikov <alekseys@google.com>
Wed, 12 Apr 2017 20:51:42 +0000 (20:51 +0000)
Summary: Remove unecessary SizeClassMap::MaxCachedHint call.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 300103

compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h

index e1172e0..a366194 100644 (file)
@@ -102,7 +102,7 @@ struct SizeClassAllocator64LocalCache {
   NOINLINE void Refill(PerClass *c, SizeClassAllocator *allocator,
                        uptr class_id) {
     InitCache();
-    uptr num_requested_chunks = SizeClassMap::MaxCachedHint(class_id);
+    uptr num_requested_chunks = c->max_count / 2;
     allocator->GetFromAllocator(&stats_, class_id, c->chunks,
                                 num_requested_chunks);
     c->count = num_requested_chunks;