mediumslab: stop assuming page-alignedness of objects

With large pages (e.g. the 64K that Debian defaults to for ppc64), this
is a bit much to ask.  It's only not true for the bottom few medium size
classes, tho', as all sizes above 256K are multiples of 64K with the
current two mantissa bits size schedule.
This commit is contained in:
Nathaniel Filardo
2020-05-12 17:35:52 +00:00
parent 87dfd41553
commit 3d3b048776
2 changed files with 3 additions and 10 deletions

View File

@@ -733,12 +733,6 @@ namespace snmalloc
size_t size1 = sizeclass_to_size(sc1);
size_t size2 = sizeclass_to_size(sc2);
// All medium size classes are page aligned.
if (i > NUM_SMALL_CLASSES)
{
SNMALLOC_ASSERT(is_aligned_block<OS_PAGE_SIZE>(nullptr, size1));
}
SNMALLOC_ASSERT(sc1 == i);
SNMALLOC_ASSERT(sc1 == sc2);
SNMALLOC_ASSERT(size1 == size);

View File

@@ -85,11 +85,10 @@ namespace snmalloc
void* p = pointer_offset(this, (static_cast<size_t>(index) << 8));
free--;
SNMALLOC_ASSERT(is_aligned_block<OS_PAGE_SIZE>(p, OS_PAGE_SIZE));
size = bits::align_up(size, OS_PAGE_SIZE);
if constexpr (zero_mem == YesZero)
memory_provider.template zero<true>(p, size);
memory_provider.zero(p, size);
else
UNUSED(size);
return p;
}