NFC: Rename ConceptPAL to IsPAL
This commit is contained in:
committed by
Nathaniel Filardo
parent
9e0fefc3b0
commit
db3ae1c8e3
@@ -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>
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace snmalloc
|
||||
/**
|
||||
* A single fixed address range allocator configuration
|
||||
*/
|
||||
template<SNMALLOC_CONCEPT(ConceptPAL) PAL>
|
||||
template<SNMALLOC_CONCEPT(IsPAL) PAL>
|
||||
class FixedRangeConfig final : public CommonConfig
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -18,11 +18,7 @@ namespace snmalloc
|
||||
template<typename SlabMetadata>
|
||||
class StrictProvenanceSlabMetadataMixin : public SlabMetadata
|
||||
{
|
||||
template<
|
||||
SNMALLOC_CONCEPT(ConceptPAL) A1,
|
||||
typename A2,
|
||||
typename A3,
|
||||
typename A4>
|
||||
template<SNMALLOC_CONCEPT(IsPAL) A1, typename A2, typename A3, typename A4>
|
||||
friend class BackendAllocator;
|
||||
|
||||
capptr::Arena<void> arena;
|
||||
|
||||
@@ -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<SNMALLOC_CONCEPT(IsPAL) A1, typename A2, typename A3, typename A4>
|
||||
friend class BackendAllocator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace snmalloc
|
||||
{
|
||||
template<SNMALLOC_CONCEPT(ConceptPAL) PAL>
|
||||
template<SNMALLOC_CONCEPT(IsPAL) PAL>
|
||||
class PalRange
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace snmalloc
|
||||
*/
|
||||
template<typename Config>
|
||||
concept IsConfig = std::is_base_of<CommonConfig, Config>::value&&
|
||||
ConceptPAL<typename Config::Pal>&& IsBackend<
|
||||
IsPAL<typename Config::Pal>&& IsBackend<
|
||||
typename Config::LocalState,
|
||||
typename Config::PagemapEntry,
|
||||
typename Config::Backend>&& requires()
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace snmalloc
|
||||
* PALs must advertize the bit vector of their supported features.
|
||||
*/
|
||||
template<typename PAL>
|
||||
concept ConceptPAL_static_features = requires()
|
||||
concept IsPAL_static_features = requires()
|
||||
{
|
||||
typename std::integral_constant<uint64_t, PAL::pal_features>;
|
||||
};
|
||||
@@ -28,7 +28,7 @@ namespace snmalloc
|
||||
* PALs must advertise the size of the address space and their page size
|
||||
*/
|
||||
template<typename PAL>
|
||||
concept ConceptPAL_static_sizes = requires()
|
||||
concept IsPAL_static_sizes = requires()
|
||||
{
|
||||
typename std::integral_constant<std::size_t, PAL::address_bits>;
|
||||
typename std::integral_constant<std::size_t, PAL::page_size>;
|
||||
@@ -38,7 +38,7 @@ namespace snmalloc
|
||||
* PALs expose an error reporting function which takes a const C string.
|
||||
*/
|
||||
template<typename PAL>
|
||||
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<typename PAL>
|
||||
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<typename PAL>
|
||||
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<typename PAL>
|
||||
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<typename PAL>
|
||||
concept ConceptPAL_reserve_aligned = requires(std::size_t sz)
|
||||
concept IsPAL_reserve_aligned = requires(std::size_t sz)
|
||||
{
|
||||
{
|
||||
PAL::template reserve_aligned<true>(sz)
|
||||
@@ -122,7 +122,7 @@ namespace snmalloc
|
||||
* Some PALs can provide memory pressure callbacks.
|
||||
*/
|
||||
template<typename PAL>
|
||||
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<typename PAL>
|
||||
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<typename PAL>
|
||||
concept ConceptPAL = ConceptPAL_static_features<PAL>&&
|
||||
ConceptPAL_static_sizes<PAL>&& ConceptPAL_error<PAL>&&
|
||||
ConceptPAL_memops<PAL>&& ConceptPAL_tid<PAL> &&
|
||||
(!pal_supports<Entropy, PAL> ||
|
||||
ConceptPAL_get_entropy64<
|
||||
PAL>)&&(!pal_supports<LowMemoryNotification, PAL> ||
|
||||
ConceptPAL_mem_low_notify<
|
||||
PAL>)&&(pal_supports<NoAllocation, PAL> ||
|
||||
((!pal_supports<AlignedAllocation, PAL> ||
|
||||
ConceptPAL_reserve_aligned<
|
||||
PAL>)&&ConceptPAL_reserve<PAL>));
|
||||
concept IsPAL =
|
||||
IsPAL_static_features<PAL> &&
|
||||
IsPAL_static_sizes<PAL> &&
|
||||
IsPAL_error<PAL> &&
|
||||
IsPAL_memops<PAL> &&
|
||||
IsPAL_tid<PAL> &&
|
||||
(!pal_supports<Entropy, PAL> || IsPAL_get_entropy64<PAL>) &&
|
||||
(!pal_supports<LowMemoryNotification, PAL> || IsPAL_mem_low_notify<PAL>) &&
|
||||
(pal_supports<NoAllocation, PAL> ||
|
||||
((!pal_supports<AlignedAllocation, PAL> || IsPAL_reserve_aligned<PAL>) &&
|
||||
IsPAL_reserve<PAL>));
|
||||
// clang-format on
|
||||
|
||||
} // namespace snmalloc
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace snmalloc
|
||||
* The minimal subset of a PAL that we need for delegation
|
||||
*/
|
||||
template<typename PAL>
|
||||
concept PALNoAllocBase = ConceptPAL_static_sizes<PAL>&& ConceptPAL_error<PAL>;
|
||||
concept PALNoAllocBase = IsPAL_static_sizes<PAL>&& IsPAL_error<PAL>;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user