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

@@ -295,7 +295,7 @@ void test_external_pointer_large()
// store object
objects[i] = (size_t*)alloc->alloc(size);
// Store allocators size for this object
*objects[i] = Alloc::alloc_size(objects[i]);
*objects[i] = alloc->alloc_size(objects[i]);
check_external_pointer_large(objects[i]);
if (i > 0)
@@ -348,7 +348,7 @@ void test_alloc_16M()
const size_t size = 16'000'000;
void* p1 = alloc->alloc(size);
SNMALLOC_CHECK(Alloc::alloc_size(Alloc::external_pointer(p1)) >= size);
SNMALLOC_CHECK(alloc->alloc_size(Alloc::external_pointer(p1)) >= size);
alloc->dealloc(p1);
}
@@ -359,7 +359,7 @@ void test_calloc_16M()
const size_t size = 16'000'000;
void* p1 = alloc->alloc<YesZero>(size);
SNMALLOC_CHECK(Alloc::alloc_size(Alloc::external_pointer(p1)) >= size);
SNMALLOC_CHECK(alloc->alloc_size(Alloc::external_pointer(p1)) >= size);
alloc->dealloc(p1);
}
@@ -373,7 +373,7 @@ void test_calloc_large_bug()
const size_t size = (SUPERSLAB_SIZE << 3) - 7;
void* p1 = alloc->alloc<YesZero>(size);
SNMALLOC_CHECK(Alloc::alloc_size(Alloc::external_pointer(p1)) >= size);
SNMALLOC_CHECK(alloc->alloc_size(Alloc::external_pointer(p1)) >= size);
alloc->dealloc(p1);
}