NFC: Introduce pointer domestication backend support
`capptr_domesticate<Backend>(Backend::LocalState*, CapPtr<T, B>)` is the intended affordance for conversion to covert from a `CapPtr<T, B>` with `B::wildness` `Wild` to a `CapPtr<>` with `B::with_wildness<Tame>` and thence plumbed into the rest of the machinery. David added the SFINAE wrapper so that `Backend`-s now don't need to implement a domestication callback; instead, if the `Backend` does not provide a `capptr_domesticate` function, a default, which just does an explicit type cast, will be used instead. This is not yet hooked into the rest of the tree. Co-authored-by: David Chisnall <David.Chisnall@microsoft.com>
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
7e53a2e82a
commit
1a608e6066
@@ -294,6 +294,23 @@ namespace snmalloc
|
||||
UNUSED(ls);
|
||||
concretePagemap.register_range(p, sz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bounds of the memory this back-end manages as a pair of
|
||||
* addresses (start then end). This is available iff this is a
|
||||
* fixed-range Backend.
|
||||
*/
|
||||
template<bool fixed_range_ = fixed_range>
|
||||
static SNMALLOC_FAST_PATH
|
||||
std::enable_if_t<fixed_range_, std::pair<address_t, address_t>>
|
||||
get_bounds(LocalState* local_state)
|
||||
{
|
||||
static_assert(
|
||||
fixed_range_ == fixed_range, "Don't set SFINAE parameter!");
|
||||
|
||||
UNUSED(local_state);
|
||||
return concretePagemap.get_bounds();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user