Skip to content

Commit db3ae1c

Browse files
committed
NFC: Rename ConceptPAL to IsPAL
1 parent 9e0fefc commit db3ae1c

File tree

8 files changed

+29
-35
lines changed

8 files changed

+29
-35
lines changed

src/snmalloc/backend/backend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace snmalloc
99
* address space management (LocalState).
1010
*/
1111
template<
12-
SNMALLOC_CONCEPT(ConceptPAL) PAL,
12+
SNMALLOC_CONCEPT(IsPAL) PAL,
1313
typename PagemapEntry,
1414
typename Pagemap,
1515
typename LocalState>

src/snmalloc/backend/fixedglobalconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace snmalloc
88
/**
99
* A single fixed address range allocator configuration
1010
*/
11-
template<SNMALLOC_CONCEPT(ConceptPAL) PAL>
11+
template<SNMALLOC_CONCEPT(IsPAL) PAL>
1212
class FixedRangeConfig final : public CommonConfig
1313
{
1414
public:

src/snmalloc/backend_helpers/cheri_slabmetadata_mixin.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ namespace snmalloc
1818
template<typename SlabMetadata>
1919
class StrictProvenanceSlabMetadataMixin : public SlabMetadata
2020
{
21-
template<
22-
SNMALLOC_CONCEPT(ConceptPAL) A1,
23-
typename A2,
24-
typename A3,
25-
typename A4>
21+
template<SNMALLOC_CONCEPT(IsPAL) A1, typename A2, typename A3, typename A4>
2622
friend class BackendAllocator;
2723

2824
capptr::Arena<void> arena;

src/snmalloc/backend_helpers/defaultpagemapentry.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ namespace snmalloc
2424
/**
2525
* The private initialising constructor is usable only by this back end.
2626
*/
27-
template<
28-
SNMALLOC_CONCEPT(ConceptPAL) A1,
29-
typename A2,
30-
typename A3,
31-
typename A4>
27+
template<SNMALLOC_CONCEPT(IsPAL) A1, typename A2, typename A3, typename A4>
3228
friend class BackendAllocator;
3329

3430
/**

src/snmalloc/backend_helpers/palrange.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace snmalloc
55
{
6-
template<SNMALLOC_CONCEPT(ConceptPAL) PAL>
6+
template<SNMALLOC_CONCEPT(IsPAL) PAL>
77
class PalRange
88
{
99
public:

src/snmalloc/mem/backend_concept.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace snmalloc
162162
*/
163163
template<typename Config>
164164
concept IsConfig = std::is_base_of<CommonConfig, Config>::value&&
165-
ConceptPAL<typename Config::Pal>&& IsBackend<
165+
IsPAL<typename Config::Pal>&& IsBackend<
166166
typename Config::LocalState,
167167
typename Config::PagemapEntry,
168168
typename Config::Backend>&& requires()

src/snmalloc/pal/pal_concept.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace snmalloc
1919
* PALs must advertize the bit vector of their supported features.
2020
*/
2121
template<typename PAL>
22-
concept ConceptPAL_static_features = requires()
22+
concept IsPAL_static_features = requires()
2323
{
2424
typename std::integral_constant<uint64_t, PAL::pal_features>;
2525
};
@@ -28,7 +28,7 @@ namespace snmalloc
2828
* PALs must advertise the size of the address space and their page size
2929
*/
3030
template<typename PAL>
31-
concept ConceptPAL_static_sizes = requires()
31+
concept IsPAL_static_sizes = requires()
3232
{
3333
typename std::integral_constant<std::size_t, PAL::address_bits>;
3434
typename std::integral_constant<std::size_t, PAL::page_size>;
@@ -38,7 +38,7 @@ namespace snmalloc
3838
* PALs expose an error reporting function which takes a const C string.
3939
*/
4040
template<typename PAL>
41-
concept ConceptPAL_error = requires(const char* const str)
41+
concept IsPAL_error = requires(const char* const str)
4242
{
4343
{
4444
PAL::error(str)
@@ -50,7 +50,7 @@ namespace snmalloc
5050
* PALs expose a basic library of memory operations.
5151
*/
5252
template<typename PAL>
53-
concept ConceptPAL_memops = requires(void* vp, std::size_t sz)
53+
concept IsPAL_memops = requires(void* vp, std::size_t sz)
5454
{
5555
{
5656
PAL::notify_not_using(vp, sz)
@@ -82,7 +82,7 @@ namespace snmalloc
8282
* places.
8383
*/
8484
template<typename PAL>
85-
concept ConceptPAL_tid = requires()
85+
concept IsPAL_tid = requires()
8686
{
8787
{
8888
PAL::get_tid()
@@ -94,7 +94,7 @@ namespace snmalloc
9494
* Absent any feature flags, the PAL must support a crude primitive allocator
9595
*/
9696
template<typename PAL>
97-
concept ConceptPAL_reserve = requires(PAL p, std::size_t sz)
97+
concept IsPAL_reserve = requires(PAL p, std::size_t sz)
9898
{
9999
{
100100
PAL::reserve(sz)
@@ -106,7 +106,7 @@ namespace snmalloc
106106
* Some PALs expose a richer allocator which understands aligned allocations
107107
*/
108108
template<typename PAL>
109-
concept ConceptPAL_reserve_aligned = requires(std::size_t sz)
109+
concept IsPAL_reserve_aligned = requires(std::size_t sz)
110110
{
111111
{
112112
PAL::template reserve_aligned<true>(sz)
@@ -122,7 +122,7 @@ namespace snmalloc
122122
* Some PALs can provide memory pressure callbacks.
123123
*/
124124
template<typename PAL>
125-
concept ConceptPAL_mem_low_notify = requires(PalNotificationObject* pno)
125+
concept IsPAL_mem_low_notify = requires(PalNotificationObject* pno)
126126
{
127127
{
128128
PAL::expensive_low_memory_check()
@@ -135,7 +135,7 @@ namespace snmalloc
135135
};
136136

137137
template<typename PAL>
138-
concept ConceptPAL_get_entropy64 = requires()
138+
concept IsPAL_get_entropy64 = requires()
139139
{
140140
{
141141
PAL::get_entropy64()
@@ -149,18 +149,20 @@ namespace snmalloc
149149
* requisite claimed pal_features. PALs not claiming particular features
150150
* are, naturally, not bound by the corresponding concept.
151151
*/
152+
// clang-format off
152153
template<typename PAL>
153-
concept ConceptPAL = ConceptPAL_static_features<PAL>&&
154-
ConceptPAL_static_sizes<PAL>&& ConceptPAL_error<PAL>&&
155-
ConceptPAL_memops<PAL>&& ConceptPAL_tid<PAL> &&
156-
(!pal_supports<Entropy, PAL> ||
157-
ConceptPAL_get_entropy64<
158-
PAL>)&&(!pal_supports<LowMemoryNotification, PAL> ||
159-
ConceptPAL_mem_low_notify<
160-
PAL>)&&(pal_supports<NoAllocation, PAL> ||
161-
((!pal_supports<AlignedAllocation, PAL> ||
162-
ConceptPAL_reserve_aligned<
163-
PAL>)&&ConceptPAL_reserve<PAL>));
154+
concept IsPAL =
155+
IsPAL_static_features<PAL> &&
156+
IsPAL_static_sizes<PAL> &&
157+
IsPAL_error<PAL> &&
158+
IsPAL_memops<PAL> &&
159+
IsPAL_tid<PAL> &&
160+
(!pal_supports<Entropy, PAL> || IsPAL_get_entropy64<PAL>) &&
161+
(!pal_supports<LowMemoryNotification, PAL> || IsPAL_mem_low_notify<PAL>) &&
162+
(pal_supports<NoAllocation, PAL> ||
163+
((!pal_supports<AlignedAllocation, PAL> || IsPAL_reserve_aligned<PAL>) &&
164+
IsPAL_reserve<PAL>));
165+
// clang-format on
164166

165167
} // namespace snmalloc
166168
#endif

src/snmalloc/pal/pal_noalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace snmalloc
1717
* The minimal subset of a PAL that we need for delegation
1818
*/
1919
template<typename PAL>
20-
concept PALNoAllocBase = ConceptPAL_static_sizes<PAL>&& ConceptPAL_error<PAL>;
20+
concept PALNoAllocBase = IsPAL_static_sizes<PAL>&& IsPAL_error<PAL>;
2121
#endif
2222

2323
/**

0 commit comments

Comments
 (0)