Let the AAL define address_t.
This commit is contained in:
@@ -46,6 +46,31 @@ namespace snmalloc
|
||||
template<class Arch>
|
||||
struct AAL_Generic : Arch
|
||||
{
|
||||
/*
|
||||
* Provide a default specification of address_t as uintptr_t for Arch-es
|
||||
* that support IntegerPointers. Those Arch-es without IntegerPoihnters
|
||||
* must explicitly give their address_t.
|
||||
*
|
||||
* This somewhat obtuse way of spelling the defaulting is necessary so
|
||||
* that all arguments to std::conditional_t are valid, even if they
|
||||
* wouldn't be valid in context. One might rather wish to say
|
||||
*
|
||||
* std::conditional_t<..., uintptr_t, Arch::address_t>
|
||||
*
|
||||
* but that requires that Arch::address_t always be given, precisely
|
||||
* the thing we're trying to avoid with the conditional.
|
||||
*/
|
||||
|
||||
struct default_address_t
|
||||
{
|
||||
using address_t = uintptr_t;
|
||||
};
|
||||
|
||||
using address_t = typename std::conditional_t<
|
||||
(Arch::aal_features & IntegerPointers) != 0,
|
||||
default_address_t,
|
||||
Arch>::address_t;
|
||||
|
||||
/**
|
||||
* Prefetch a specific address.
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace snmalloc
|
||||
* separated into two types, one for raw addresses and one for addresses that
|
||||
* can be cast back to pointers.
|
||||
*/
|
||||
using address_t = uintptr_t;
|
||||
using address_t = Aal::address_t;
|
||||
|
||||
/**
|
||||
* Perform pointer arithmetic and return the adjusted pointer.
|
||||
|
||||
Reference in New Issue
Block a user