diff --git a/src/snmalloc/backend/backend.h b/src/snmalloc/backend/backend.h index 2870a5f..9401e71 100644 --- a/src/snmalloc/backend/backend.h +++ b/src/snmalloc/backend/backend.h @@ -9,7 +9,7 @@ namespace snmalloc * address space management (LocalState). */ template< - SNMALLOC_CONCEPT(ConceptPAL) PAL, + SNMALLOC_CONCEPT(IsPAL) PAL, typename PagemapEntry, typename Pagemap, typename LocalState> diff --git a/src/snmalloc/backend/fixedglobalconfig.h b/src/snmalloc/backend/fixedglobalconfig.h index 2339074..b3d42db 100644 --- a/src/snmalloc/backend/fixedglobalconfig.h +++ b/src/snmalloc/backend/fixedglobalconfig.h @@ -8,7 +8,7 @@ namespace snmalloc /** * A single fixed address range allocator configuration */ - template + template class FixedRangeConfig final : public CommonConfig { public: diff --git a/src/snmalloc/backend_helpers/cheri_slabmetadata_mixin.h b/src/snmalloc/backend_helpers/cheri_slabmetadata_mixin.h index 2e0d75d..28e6f6d 100644 --- a/src/snmalloc/backend_helpers/cheri_slabmetadata_mixin.h +++ b/src/snmalloc/backend_helpers/cheri_slabmetadata_mixin.h @@ -18,11 +18,7 @@ namespace snmalloc template class StrictProvenanceSlabMetadataMixin : public SlabMetadata { - template< - SNMALLOC_CONCEPT(ConceptPAL) A1, - typename A2, - typename A3, - typename A4> + template friend class BackendAllocator; capptr::Arena arena; diff --git a/src/snmalloc/backend_helpers/defaultpagemapentry.h b/src/snmalloc/backend_helpers/defaultpagemapentry.h index dc95ce6..b63f26f 100644 --- a/src/snmalloc/backend_helpers/defaultpagemapentry.h +++ b/src/snmalloc/backend_helpers/defaultpagemapentry.h @@ -24,11 +24,7 @@ namespace snmalloc /** * The private initialising constructor is usable only by this back end. */ - template< - SNMALLOC_CONCEPT(ConceptPAL) A1, - typename A2, - typename A3, - typename A4> + template friend class BackendAllocator; /** diff --git a/src/snmalloc/backend_helpers/palrange.h b/src/snmalloc/backend_helpers/palrange.h index b1480a2..ade6529 100644 --- a/src/snmalloc/backend_helpers/palrange.h +++ b/src/snmalloc/backend_helpers/palrange.h @@ -3,7 +3,7 @@ namespace snmalloc { - template + template class PalRange { public: diff --git a/src/snmalloc/mem/backend_concept.h b/src/snmalloc/mem/backend_concept.h index c0f2d48..9517627 100644 --- a/src/snmalloc/mem/backend_concept.h +++ b/src/snmalloc/mem/backend_concept.h @@ -162,7 +162,7 @@ namespace snmalloc */ template concept IsConfig = std::is_base_of::value&& - ConceptPAL&& IsBackend< + IsPAL&& IsBackend< typename Config::LocalState, typename Config::PagemapEntry, typename Config::Backend>&& requires() diff --git a/src/snmalloc/pal/pal_concept.h b/src/snmalloc/pal/pal_concept.h index 789a00b..44dec41 100644 --- a/src/snmalloc/pal/pal_concept.h +++ b/src/snmalloc/pal/pal_concept.h @@ -19,7 +19,7 @@ namespace snmalloc * PALs must advertize the bit vector of their supported features. */ template - concept ConceptPAL_static_features = requires() + concept IsPAL_static_features = requires() { typename std::integral_constant; }; @@ -28,7 +28,7 @@ namespace snmalloc * PALs must advertise the size of the address space and their page size */ template - concept ConceptPAL_static_sizes = requires() + concept IsPAL_static_sizes = requires() { typename std::integral_constant; typename std::integral_constant; @@ -38,7 +38,7 @@ namespace snmalloc * PALs expose an error reporting function which takes a const C string. */ template - concept ConceptPAL_error = requires(const char* const str) + concept IsPAL_error = requires(const char* const str) { { PAL::error(str) @@ -50,7 +50,7 @@ namespace snmalloc * PALs expose a basic library of memory operations. */ template - concept ConceptPAL_memops = requires(void* vp, std::size_t sz) + concept IsPAL_memops = requires(void* vp, std::size_t sz) { { PAL::notify_not_using(vp, sz) @@ -82,7 +82,7 @@ namespace snmalloc * places. */ template - concept ConceptPAL_tid = requires() + concept IsPAL_tid = requires() { { PAL::get_tid() @@ -94,7 +94,7 @@ namespace snmalloc * Absent any feature flags, the PAL must support a crude primitive allocator */ template - concept ConceptPAL_reserve = requires(PAL p, std::size_t sz) + concept IsPAL_reserve = requires(PAL p, std::size_t sz) { { PAL::reserve(sz) @@ -106,7 +106,7 @@ namespace snmalloc * Some PALs expose a richer allocator which understands aligned allocations */ template - concept ConceptPAL_reserve_aligned = requires(std::size_t sz) + concept IsPAL_reserve_aligned = requires(std::size_t sz) { { PAL::template reserve_aligned(sz) @@ -122,7 +122,7 @@ namespace snmalloc * Some PALs can provide memory pressure callbacks. */ template - concept ConceptPAL_mem_low_notify = requires(PalNotificationObject* pno) + concept IsPAL_mem_low_notify = requires(PalNotificationObject* pno) { { PAL::expensive_low_memory_check() @@ -135,7 +135,7 @@ namespace snmalloc }; template - concept ConceptPAL_get_entropy64 = requires() + concept IsPAL_get_entropy64 = requires() { { PAL::get_entropy64() @@ -149,18 +149,20 @@ namespace snmalloc * requisite claimed pal_features. PALs not claiming particular features * are, naturally, not bound by the corresponding concept. */ + // clang-format off template - concept ConceptPAL = ConceptPAL_static_features&& - ConceptPAL_static_sizes&& ConceptPAL_error&& - ConceptPAL_memops&& ConceptPAL_tid && - (!pal_supports || - ConceptPAL_get_entropy64< - PAL>)&&(!pal_supports || - ConceptPAL_mem_low_notify< - PAL>)&&(pal_supports || - ((!pal_supports || - ConceptPAL_reserve_aligned< - PAL>)&&ConceptPAL_reserve)); + concept IsPAL = + IsPAL_static_features && + IsPAL_static_sizes && + IsPAL_error && + IsPAL_memops && + IsPAL_tid && + (!pal_supports || IsPAL_get_entropy64) && + (!pal_supports || IsPAL_mem_low_notify) && + (pal_supports || + ((!pal_supports || IsPAL_reserve_aligned) && + IsPAL_reserve)); + // clang-format on } // namespace snmalloc #endif diff --git a/src/snmalloc/pal/pal_noalloc.h b/src/snmalloc/pal/pal_noalloc.h index d44d149..94bc61e 100644 --- a/src/snmalloc/pal/pal_noalloc.h +++ b/src/snmalloc/pal/pal_noalloc.h @@ -17,7 +17,7 @@ namespace snmalloc * The minimal subset of a PAL that we need for delegation */ template - concept PALNoAllocBase = ConceptPAL_static_sizes&& ConceptPAL_error; + concept PALNoAllocBase = IsPAL_static_sizes&& IsPAL_error; #endif /**