From c2ce9c118d9deba96cb552904f8ae6a0087fca86 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sun, 17 Oct 2021 17:23:39 +0100 Subject: [PATCH] NFC: Racing stripes on Metaslab accessors Even on debug builds, these little things should be inlined --- src/mem/metaslab.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mem/metaslab.h b/src/mem/metaslab.h index 614dd00..7e61dae 100644 --- a/src/mem/metaslab.h +++ b/src/mem/metaslab.h @@ -203,10 +203,12 @@ namespace snmalloc * the second argument of this must always be the return value from * `get_remote_and_sizeclass`. */ + SNMALLOC_FAST_PATH MetaEntry(Metaslab* meta, uintptr_t remote_and_sizeclass) : meta(meta), remote_and_sizeclass(remote_and_sizeclass) {} + SNMALLOC_FAST_PATH MetaEntry(Metaslab* meta, RemoteAllocator* remote, sizeclass_t sizeclass) : meta(meta) { @@ -215,7 +217,7 @@ namespace snmalloc pointer_offset(reinterpret_cast(remote), sizeclass); } - [[nodiscard]] Metaslab* get_metaslab() const + [[nodiscard]] SNMALLOC_FAST_PATH Metaslab* get_metaslab() const { return meta; } @@ -226,18 +228,18 @@ namespace snmalloc * only safe use for this is to pass it to the two-argument constructor of * this class. */ - uintptr_t get_remote_and_sizeclass() + [[nodiscard]] SNMALLOC_FAST_PATH uintptr_t get_remote_and_sizeclass() { return remote_and_sizeclass; } - [[nodiscard]] RemoteAllocator* get_remote() const + [[nodiscard]] SNMALLOC_FAST_PATH RemoteAllocator* get_remote() const { return reinterpret_cast( pointer_align_down(remote_and_sizeclass)); } - [[nodiscard]] sizeclass_t get_sizeclass() const + [[nodiscard]] SNMALLOC_FAST_PATH sizeclass_t get_sizeclass() const { return remote_and_sizeclass & (alignof(RemoteAllocator) - 1); }