From 830b06a616a36271c5097cd81f552cbda678fd5b Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 26 Jun 2019 16:53:39 +0100 Subject: [PATCH] Add a couple of likely annotations. --- src/ds/helpers.h | 2 +- src/mem/threadalloc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ds/helpers.h b/src/ds/helpers.h index e94227d..fdae63f 100644 --- a/src/ds/helpers.h +++ b/src/ds/helpers.h @@ -27,7 +27,7 @@ namespace snmalloc // If defined should be initially false; assert(first == nullptr || *first == false); - if (!initialised.load(std::memory_order_acquire)) + if (unlikely(!initialised.load(std::memory_order_acquire))) { FlagLock lock(flag); if (!initialised) diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 59a05e3..98f8096 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -284,7 +284,7 @@ namespace snmalloc { Alloc*& per_thread = inner_get(); - if (per_thread != nullptr) + if (likely(per_thread != nullptr)) return per_thread; // Slow path that performs initialization