зеркало из https://github.com/microsoft/snmalloc.git
Merge pull request #23 from Microsoft/comment
Fix comment to represent current PAL API.
This commit is contained in:
Коммит
9a6b0aef1f
|
@ -943,7 +943,7 @@ namespace snmalloc
|
|||
{
|
||||
super_available.remove(super);
|
||||
|
||||
if (decommit_strategy == DecommitSuper)
|
||||
if constexpr (decommit_strategy == DecommitSuper)
|
||||
{
|
||||
large_allocator.memory_provider.notify_not_using(
|
||||
(void*)((size_t)super + OS_PAGE_SIZE),
|
||||
|
@ -1027,7 +1027,7 @@ namespace snmalloc
|
|||
sc->remove(slab);
|
||||
}
|
||||
|
||||
if (decommit_strategy == DecommitSuper)
|
||||
if constexpr (decommit_strategy == DecommitSuper)
|
||||
{
|
||||
large_allocator.memory_provider.notify_not_using(
|
||||
(void*)((size_t)slab + OS_PAGE_SIZE),
|
||||
|
|
|
@ -138,7 +138,7 @@ namespace snmalloc
|
|||
{
|
||||
if (((size_t)reserved_start + need) > (size_t)reserved_end)
|
||||
{
|
||||
if (allow_reserve == YesReserve)
|
||||
if constexpr (allow_reserve == YesReserve)
|
||||
{
|
||||
stats.segment_create();
|
||||
reserved_start =
|
||||
|
@ -191,10 +191,13 @@ namespace snmalloc
|
|||
{
|
||||
if ((decommit_strategy != DecommitNone) || (large_class > 0))
|
||||
{
|
||||
// Only the first page needs to be zeroed, as this was decommitted.
|
||||
if (zero_mem == YesZero)
|
||||
// The first page is already in "use" for the stack element,
|
||||
// this will need zeroing for a YesZero call.
|
||||
if constexpr (zero_mem == YesZero)
|
||||
memory_provider.template zero<true>(p, OS_PAGE_SIZE);
|
||||
|
||||
// Notify we are using the rest of the allocation.
|
||||
// Passing zero_mem ensures the PAL provides zeroed pages if required.
|
||||
memory_provider.template notify_using<zero_mem>(
|
||||
(void*)((size_t)p + OS_PAGE_SIZE),
|
||||
bits::align_up(size, OS_PAGE_SIZE) - OS_PAGE_SIZE);
|
||||
|
@ -202,7 +205,7 @@ namespace snmalloc
|
|||
else
|
||||
{
|
||||
// This is a superslab that has not been decommitted.
|
||||
if (zero_mem == YesZero)
|
||||
if constexpr (zero_mem == YesZero)
|
||||
memory_provider.template zero<true>(
|
||||
p, bits::align_up(size, OS_PAGE_SIZE));
|
||||
}
|
||||
|
|
|
@ -86,9 +86,9 @@ namespace snmalloc
|
|||
assert(bits::is_aligned_block<OS_PAGE_SIZE>(p, OS_PAGE_SIZE));
|
||||
size = bits::align_up(size, OS_PAGE_SIZE);
|
||||
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
memory_provider.template notify_using<zero_mem>(p, size);
|
||||
else if (zero_mem == YesZero)
|
||||
else if constexpr (zero_mem == YesZero)
|
||||
memory_provider.template zero<true>(p, size);
|
||||
|
||||
return p;
|
||||
|
@ -104,7 +104,7 @@ namespace snmalloc
|
|||
free++;
|
||||
stack[--head] = pointer_to_index(p);
|
||||
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
memory_provider.notify_not_using(p, sizeclass_to_size(sizeclass));
|
||||
|
||||
return was_full;
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace snmalloc
|
|||
meta[0].sizeclass = sizeclass;
|
||||
meta[0].link = SLABLINK_INDEX;
|
||||
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
{
|
||||
memory_provider.template notify_using<NoZero>(
|
||||
(void*)((size_t)this + OS_PAGE_SIZE), SLAB_SIZE - OS_PAGE_SIZE);
|
||||
|
@ -194,7 +194,7 @@ namespace snmalloc
|
|||
head = h + n + 1;
|
||||
used += 2;
|
||||
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
{
|
||||
memory_provider.template notify_using<NoZero>(slab, SLAB_SIZE);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ namespace snmalloc
|
|||
bool was_almost_full = is_almost_full();
|
||||
used -= 2;
|
||||
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
memory_provider.notify_not_using(slab, SLAB_SIZE);
|
||||
|
||||
assert(meta[index].is_unused());
|
||||
|
@ -231,7 +231,7 @@ namespace snmalloc
|
|||
Action dealloc_short_slab(MemoryProvider& memory_provider)
|
||||
{
|
||||
// This is the short slab.
|
||||
if (decommit_strategy == DecommitAll)
|
||||
if constexpr (decommit_strategy == DecommitAll)
|
||||
{
|
||||
memory_provider.notify_not_using(
|
||||
(void*)((size_t)this + OS_PAGE_SIZE), SLAB_SIZE - OS_PAGE_SIZE);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace snmalloc
|
|||
{
|
||||
assert(
|
||||
bits::is_aligned_block<OS_PAGE_SIZE>(p, size) || (zero_mem == NoZero));
|
||||
if (zero_mem == YesZero)
|
||||
if constexpr (zero_mem == YesZero)
|
||||
zero(p, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace snmalloc
|
|||
assert(
|
||||
bits::is_aligned_block<OS_PAGE_SIZE>(p, size) || (zero_mem == NoZero));
|
||||
|
||||
if (zero_mem == YesZero)
|
||||
if constexpr (zero_mem == YesZero)
|
||||
zero<true>(p, size);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче