diff --git a/src/aal/aal.h b/src/aal/aal.h index 55b1477..c6bab95 100644 --- a/src/aal/aal.h +++ b/src/aal/aal.h @@ -46,6 +46,31 @@ namespace snmalloc template 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. * diff --git a/src/ds/address.h b/src/ds/address.h index 720f1af..c1c837d 100644 --- a/src/ds/address.h +++ b/src/ds/address.h @@ -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.