Skip to content

Commit a3d5477

Browse files
nwf-msrmjp41
authored andcommitted
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.
1 parent 82bc0e6 commit a3d5477

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/mem/address_space.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace snmalloc
1313
* It cannot unreserve memory, so this does not require the
1414
* usual complexity of a buddy allocator.
1515
*/
16-
template<typename Pal>
17-
class AddressSpaceManager : public Pal
16+
template<typename PAL>
17+
class AddressSpaceManager : public PAL
1818
{
1919
/**
2020
* Stores the blocks of address space
@@ -160,7 +160,7 @@ namespace snmalloc
160160
auto page_start = pointer_align_down<OS_PAGE_SIZE, char>(base);
161161
auto page_end =
162162
pointer_align_up<OS_PAGE_SIZE, char>(pointer_offset(base, size));
163-
Pal::template notify_using<NoZero>(
163+
PAL::template notify_using<NoZero>(
164164
page_start, static_cast<size_t>(page_end - page_start));
165165
}
166166

@@ -178,10 +178,10 @@ namespace snmalloc
178178
SNMALLOC_ASSERT(bits::next_pow2(size) == size);
179179
SNMALLOC_ASSERT(size >= sizeof(void*));
180180

181-
if constexpr (pal_supports<AlignedAllocation, Pal>)
181+
if constexpr (pal_supports<AlignedAllocation, PAL>)
182182
{
183-
if (size >= Pal::minimum_alloc_size)
184-
return static_cast<Pal*>(this)->template reserve_aligned<committed>(
183+
if (size >= PAL::minimum_alloc_size)
184+
return static_cast<PAL*>(this)->template reserve_aligned<committed>(
185185
size);
186186
}
187187

@@ -194,20 +194,20 @@ namespace snmalloc
194194
// Allocation failed ask OS for more memory
195195
void* block;
196196
size_t block_size;
197-
if constexpr (pal_supports<AlignedAllocation, Pal>)
197+
if constexpr (pal_supports<AlignedAllocation, PAL>)
198198
{
199-
block_size = Pal::minimum_alloc_size;
200-
block = static_cast<Pal*>(this)->template reserve_aligned<false>(
199+
block_size = PAL::minimum_alloc_size;
200+
block = static_cast<PAL*>(this)->template reserve_aligned<false>(
201201
block_size);
202202
}
203203
else
204204
{
205205
// Need at least 2 times the space to guarantee alignment.
206206
// Hold lock here as a race could cause additional requests to
207-
// the Pal, and this could lead to suprious OOM. This is
208-
// particularly bad if the Pal gives all the memory on first call.
207+
// the PAL, and this could lead to suprious OOM. This is
208+
// particularly bad if the PAL gives all the memory on first call.
209209
auto block_and_size =
210-
static_cast<Pal*>(this)->reserve_at_least(size * 2);
210+
static_cast<PAL*>(this)->reserve_at_least(size * 2);
211211
block = block_and_size.first;
212212
block_size = block_and_size.second;
213213

0 commit comments

Comments
 (0)