Prepare for PAL address_bits
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
4a4ca96125
commit
e212ddd0e0
@@ -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>;
|
||||
};
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user