pagemap: assert that entry types match

More directly ensure that a "basic" pagemap's type matches its
"concrete" pagemap parameter's entry type.  Absent this check, getting
this wrong won't be detected until even further along in template code
generation (when considering a method that sees the mismatch).
This commit is contained in:
Nathaniel Wesley Filardo
2022-11-28 04:39:05 +00:00
committed by Nathaniel Filardo
parent 2936467736
commit 30da31d245
2 changed files with 6 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ namespace snmalloc
*/
using Entry = PagemapEntry;
static_assert(
std::is_same_v<PagemapEntry, typename ConcreteMap::EntryType>,
"BasicPagemap's PagemapEntry and ConcreteMap disagree!");
/**
* Instance of the concrete pagemap, accessible to the backend so that
* it can call the init method whose type dependent on fixed_range.

View File

@@ -48,6 +48,8 @@ namespace snmalloc
size_t size{0};
public:
using EntryType = T;
/**
* Ensure this range of pagemap is accessible
*/