[compiler-rt] afa3fed - [NFC][sanitizer] Exctract DrainHalfMax
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 13 15:33:38 PDT 2021
Author: Vitaly Buka
Date: 2021-07-13T15:33:22-07:00
New Revision: afa3fedcda98db4d47694ed596270a5396074224
URL: https://github.com/llvm/llvm-project/commit/afa3fedcda98db4d47694ed596270a5396074224
DIFF: https://github.com/llvm/llvm-project/commit/afa3fedcda98db4d47694ed596270a5396074224.diff
LOG: [NFC][sanitizer] Exctract DrainHalfMax
Part of D105778
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
index b83f06ee300a..5f436e753818 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
@@ -54,7 +54,7 @@ struct SizeClassAllocator64LocalCache {
PerClass *c = &per_class_[class_id];
InitCache(c);
if (UNLIKELY(c->count == c->max_count))
- Drain(c, allocator, class_id, c->max_count / 2);
+ DrainHalfMax(c, allocator, class_id);
CompactPtrT chunk = allocator->PointerToCompactPtr(
allocator->GetRegionBeginBySizeClass(class_id),
reinterpret_cast<uptr>(p));
@@ -105,6 +105,10 @@ struct SizeClassAllocator64LocalCache {
c->count = num_requested_chunks;
return true;
}
+ NOINLINE void DrainHalfMax(PerClass *c, SizeClassAllocator *allocator,
+ uptr class_id) {
+ Drain(c, allocator, class_id, c->max_count / 2);
+ }
NOINLINE void Drain(PerClass *c, SizeClassAllocator *allocator, uptr class_id,
uptr count) {
More information about the llvm-commits
mailing list