@@ -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
0 commit comments