forked from OSchip/llvm-project
parent
5df9995439
commit
afa3fedcda
|
@ -54,7 +54,7 @@ struct SizeClassAllocator64LocalCache {
|
||||||
PerClass *c = &per_class_[class_id];
|
PerClass *c = &per_class_[class_id];
|
||||||
InitCache(c);
|
InitCache(c);
|
||||||
if (UNLIKELY(c->count == c->max_count))
|
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(
|
CompactPtrT chunk = allocator->PointerToCompactPtr(
|
||||||
allocator->GetRegionBeginBySizeClass(class_id),
|
allocator->GetRegionBeginBySizeClass(class_id),
|
||||||
reinterpret_cast<uptr>(p));
|
reinterpret_cast<uptr>(p));
|
||||||
|
@ -105,6 +105,10 @@ struct SizeClassAllocator64LocalCache {
|
||||||
c->count = num_requested_chunks;
|
c->count = num_requested_chunks;
|
||||||
return true;
|
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,
|
NOINLINE void Drain(PerClass *c, SizeClassAllocator *allocator, uptr class_id,
|
||||||
uptr count) {
|
uptr count) {
|
||||||
|
|
Loading…
Reference in New Issue