Prepare for PAL address_bits

This commit is contained in:
Nathaniel Wesley Filardo
2021-07-21 16:14:03 +01:00
committed by Nathaniel Wesley Filardo
parent 4a4ca96125
commit e212ddd0e0
4 changed files with 21 additions and 1 deletions

View File

@@ -26,11 +26,12 @@ namespace snmalloc
};
/**
* PALs must advertise their page size
* PALs must advertise the size of the address space and their page size
*/
template<typename PAL>
concept ConceptPAL_static_sizes = requires()
{
typename std::integral_constant<std::size_t, PAL::address_bits>;
typename std::integral_constant<std::size_t, PAL::page_size>;
};

View File

@@ -37,6 +37,8 @@ namespace snmalloc
static constexpr size_t page_size = BasePAL::page_size;
static constexpr size_t address_bits = Aal::address_bits;
/**
* Print a stack trace.
*/

View File

@@ -132,6 +132,18 @@ namespace snmalloc
static constexpr size_t page_size = Aal::smallest_page_size;
/**
* Address bits are potentially mediated by some POSIX OSes, but generally
* default to the architecture's.
*
* Unlike the AALs, which are composited by explicitly delegating to their
* template parameters and so play a SFINAE-based game to achieve similar
* ends, for the PALPOSIX<> classes we instead use more traditional
* inheritance (e.g., PALLinux is subtype of PALPOSIX<PALLinux>) and so we
* can just use that mechanism here, too.
*/
static constexpr size_t address_bits = Aal::address_bits;
static void print_stack_trace()
{
#ifdef SNMALLOC_BACKTRACE_HEADER

View File

@@ -62,6 +62,11 @@ namespace snmalloc
static constexpr size_t page_size = 0x1000;
/**
* Windows always inherits its underlying architecture's full address range.
*/
static constexpr size_t address_bits = Aal::address_bits;
/**
* Check whether the low memory state is still in effect. This is an
* expensive operation and should not be on any fast paths.