alloc: de-static alloc_size

We're going to need to amplify the pointer and that's going to require access
to our AddressSpaceManager, which we only get non-statically through our
LargeAlloc.

This patch unto itself makes the world slower, perhaps because Clang can't see
the certainty of aliasing of the static and non-static paths to the same
structure.  However, when we also de-static external_pointer, that goes away and
things return to the status quo ante.
This commit is contained in:
Nathaniel Filardo
2020-11-20 17:47:56 +00:00
committed by Matthew Parkinson
parent c9588655b0
commit 1042fc908a
4 changed files with 9 additions and 9 deletions

View File

@@ -429,13 +429,13 @@ namespace snmalloc
}
public:
SNMALLOC_FAST_PATH static size_t alloc_size(const void* p)
SNMALLOC_FAST_PATH size_t alloc_size(const void* p)
{
#ifdef SNMALLOC_PASS_THROUGH
return external_alloc::malloc_usable_size(const_cast<void*>(p));
#else
// This must be called on an external pointer.
size_t chunkmap_slab_kind = ChunkMap::get(address_cast(p));
size_t chunkmap_slab_kind = chunkmap().get(address_cast(p));
if (likely(chunkmap_slab_kind == CMSuperslab))
{