Stop playing OO games with MetaEntry
David points out that the downcasts I had introduced were UB. Instead, go back
to passing MetaEntry-s around and make MetaslabMetaEntry just a namespace of
static methods.
This partially reverts 7940fee00c
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
e77b9e2851
commit
6424edaeaa
@@ -58,14 +58,10 @@ namespace snmalloc
|
||||
* Set template parameter to true if it not an error
|
||||
* to access a location that is not backed by a chunk.
|
||||
*/
|
||||
template<typename Ret = MetaEntry, bool potentially_out_of_range = false>
|
||||
SNMALLOC_FAST_PATH static const Ret& get_metaentry(address_t p)
|
||||
template<bool potentially_out_of_range = false>
|
||||
SNMALLOC_FAST_PATH static const MetaEntry& get_metaentry(address_t p)
|
||||
{
|
||||
static_assert(
|
||||
std::is_base_of_v<MetaEntry, Ret> && sizeof(MetaEntry) == sizeof(Ret),
|
||||
"Backend Pagemap get_metaentry return must look like MetaEntry");
|
||||
return static_cast<const Ret&>(
|
||||
concretePagemap.template get<potentially_out_of_range>(p));
|
||||
return concretePagemap.template get<potentially_out_of_range>(p);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user