From 486ef10c212df464da0b6bb429fad8fc251d62a3 Mon Sep 17 00:00:00 2001 From: Nathaniel Filardo Date: Fri, 19 Mar 2021 13:49:40 +0000 Subject: [PATCH] NFC: bump pointers have just one associated Slab Rather than ::get()-ing the `Superslab` and `Slab` for each object we just created from the bump pointer, recognize that these objects necessarily come from the same `Slab` (and so the same `Superslab`). In the eventuality of CHERI, this means we'll amplify once per bump pointer, not once per created object. --- src/mem/alloc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 1098224..dce3f81 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -750,15 +750,15 @@ namespace snmalloc auto& bp = bump_ptrs[i]; auto rsize = sizeclass_to_size(i); FreeListIter ffl; + + Superslab* super = Superslab::get(bp); + Slab* slab = Metaslab::get_slab(bp); while (pointer_align_up(bp, SLAB_SIZE) != bp) { Slab::alloc_new_list(bp, ffl, rsize); while (!ffl.empty()) { - auto curr = ffl.take(); - Superslab* super = Superslab::get(curr); - Slab* slab = Metaslab::get_slab(curr); - small_dealloc_offseted_inner(super, slab, curr, i); + small_dealloc_offseted_inner(super, slab, ffl.take(), i); } } }