alloc: de-static external_pointer
Like alloc_size, this will require amplification internally. This patch also restores performance to the status quo ante; Clang can once again see enough to generate the same code as it did before de-static-ing alloc_size.
This commit is contained in:
committed by
Matthew Parkinson
parent
1042fc908a
commit
f295a3f191
@@ -241,8 +241,8 @@ void test_external_pointer()
|
||||
for (size_t offset = 0; offset < size; offset += 17)
|
||||
{
|
||||
void* p2 = pointer_offset(p1, offset);
|
||||
void* p3 = Alloc::external_pointer(p2);
|
||||
void* p4 = Alloc::external_pointer<End>(p2);
|
||||
void* p3 = alloc->external_pointer(p2);
|
||||
void* p4 = alloc->external_pointer<End>(p2);
|
||||
UNUSED(p3);
|
||||
UNUSED(p4);
|
||||
SNMALLOC_CHECK(p1 == p3);
|
||||
@@ -257,7 +257,8 @@ void test_external_pointer()
|
||||
|
||||
void check_offset(void* base, void* interior)
|
||||
{
|
||||
void* calced_base = Alloc::external_pointer((void*)interior);
|
||||
auto alloc = ThreadAlloc::get();
|
||||
void* calced_base = alloc->external_pointer((void*)interior);
|
||||
if (calced_base != (void*)base)
|
||||
abort();
|
||||
}
|
||||
@@ -335,7 +336,7 @@ void test_external_pointer_dealloc_bug()
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
Alloc::external_pointer(allocs[i]);
|
||||
alloc->external_pointer(allocs[i]);
|
||||
}
|
||||
|
||||
alloc->dealloc(allocs[0]);
|
||||
@@ -348,7 +349,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 +360,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 +374,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user