From a3d54779c81b0635188d9a5901a9181e6119c2c5 Mon Sep 17 00:00:00 2001 From: Nathaniel Filardo Date: Wed, 2 Sep 2020 12:45:50 +0100 Subject: [PATCH] AddressSpaceManager: template parameter "PAL" not "Pal" "Pal" is a global symbol for the current architecture's platform abstraction layer class (see src/pal/pal.h); to be less confusing, don't shadow it with a template parameter on the AddressSpaceManager class, and instead use "PAL" as is done elsewhere for template arguments. --- src/mem/address_space.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mem/address_space.h b/src/mem/address_space.h index 2b41ac7..a727f0b 100644 --- a/src/mem/address_space.h +++ b/src/mem/address_space.h @@ -13,8 +13,8 @@ namespace snmalloc * It cannot unreserve memory, so this does not require the * usual complexity of a buddy allocator. */ - template - class AddressSpaceManager : public Pal + template + class AddressSpaceManager : public PAL { /** * Stores the blocks of address space @@ -160,7 +160,7 @@ namespace snmalloc auto page_start = pointer_align_down(base); auto page_end = pointer_align_up(pointer_offset(base, size)); - Pal::template notify_using( + PAL::template notify_using( page_start, static_cast(page_end - page_start)); } @@ -178,10 +178,10 @@ namespace snmalloc SNMALLOC_ASSERT(bits::next_pow2(size) == size); SNMALLOC_ASSERT(size >= sizeof(void*)); - if constexpr (pal_supports) + if constexpr (pal_supports) { - if (size >= Pal::minimum_alloc_size) - return static_cast(this)->template reserve_aligned( + if (size >= PAL::minimum_alloc_size) + return static_cast(this)->template reserve_aligned( size); } @@ -194,20 +194,20 @@ namespace snmalloc // Allocation failed ask OS for more memory void* block; size_t block_size; - if constexpr (pal_supports) + if constexpr (pal_supports) { - block_size = Pal::minimum_alloc_size; - block = static_cast(this)->template reserve_aligned( + block_size = PAL::minimum_alloc_size; + block = static_cast(this)->template reserve_aligned( block_size); } else { // Need at least 2 times the space to guarantee alignment. // Hold lock here as a race could cause additional requests to - // the Pal, and this could lead to suprious OOM. This is - // particularly bad if the Pal gives all the memory on first call. + // the PAL, and this could lead to suprious OOM. This is + // particularly bad if the PAL gives all the memory on first call. auto block_and_size = - static_cast(this)->reserve_at_least(size * 2); + static_cast(this)->reserve_at_least(size * 2); block = block_and_size.first; block_size = block_and_size.second;