NFC: rename ConceptBound to IsBound
This commit is contained in:
committed by
Nathaniel Filardo
parent
df1dbc997f
commit
b2c75dffb7
@@ -175,7 +175,7 @@ We introduce a multi-dimensional space of bounds. The facets are `enum class`-e
|
|||||||
* `Wildness` captures whether the pointer has been checked to belong to this allocator.
|
* `Wildness` captures whether the pointer has been checked to belong to this allocator.
|
||||||
|
|
||||||
These `dimension`s are composited using a `capptr::bound<>` type that we use as `B` in `CapPtr<T, B>`.
|
These `dimension`s are composited using a `capptr::bound<>` type that we use as `B` in `CapPtr<T, B>`.
|
||||||
This is enforced (loosely) using the `ConceptBound` C++20 concept.
|
This is enforced (loosely) using the `IsBound` C++20 concept.
|
||||||
|
|
||||||
The namespace `snmalloc::capptr::bounds` contains particular points in the space of `capptr::bound<>` types:
|
The namespace `snmalloc::capptr::bounds` contains particular points in the space of `capptr::bound<>` types:
|
||||||
|
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ namespace snmalloc
|
|||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BOut,
|
SNMALLOC_CONCEPT(capptr::IsBound) BOut,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BIn,
|
SNMALLOC_CONCEPT(capptr::IsBound) BIn,
|
||||||
typename U = T>
|
typename U = T>
|
||||||
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
|
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
|
||||||
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept
|
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ namespace snmalloc
|
|||||||
|
|
||||||
template<
|
template<
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BOut,
|
SNMALLOC_CONCEPT(capptr::IsBound) BOut,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BIn,
|
SNMALLOC_CONCEPT(capptr::IsBound) BIn,
|
||||||
typename U = T>
|
typename U = T>
|
||||||
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
|
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
|
||||||
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept
|
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace snmalloc
|
|||||||
unsafe_to_uintptr<T>(base) + static_cast<uintptr_t>(diff));
|
unsafe_to_uintptr<T>(base) + static_cast<uintptr_t>(diff));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds, typename T>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
|
||||||
inline CapPtr<void, bounds>
|
inline CapPtr<void, bounds>
|
||||||
pointer_offset(CapPtr<T, bounds> base, size_t diff)
|
pointer_offset(CapPtr<T, bounds> base, size_t diff)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ namespace snmalloc
|
|||||||
return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + diff);
|
return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds, typename T>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
|
||||||
inline CapPtr<void, bounds>
|
inline CapPtr<void, bounds>
|
||||||
pointer_offset_signed(CapPtr<T, bounds> base, ptrdiff_t diff)
|
pointer_offset_signed(CapPtr<T, bounds> base, ptrdiff_t diff)
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ namespace snmalloc
|
|||||||
* as per above, and uses the wrapper types in its own definition, e.g., of
|
* as per above, and uses the wrapper types in its own definition, e.g., of
|
||||||
* capptr_bound.
|
* capptr_bound.
|
||||||
*/
|
*/
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
inline SNMALLOC_FAST_PATH address_t address_cast(CapPtr<T, bounds> a)
|
inline SNMALLOC_FAST_PATH address_t address_cast(CapPtr<T, bounds> a)
|
||||||
{
|
{
|
||||||
return address_cast(a.unsafe_ptr());
|
return address_cast(a.unsafe_ptr());
|
||||||
@@ -136,7 +136,7 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
size_t alignment,
|
size_t alignment,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
inline CapPtr<T, bounds> pointer_align_down(CapPtr<void, bounds> p)
|
inline CapPtr<T, bounds> pointer_align_down(CapPtr<void, bounds> p)
|
||||||
{
|
{
|
||||||
return CapPtr<T, bounds>::unsafe_from(
|
return CapPtr<T, bounds>::unsafe_from(
|
||||||
@@ -174,7 +174,7 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
size_t alignment,
|
size_t alignment,
|
||||||
typename T = void,
|
typename T = void,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
inline CapPtr<T, bounds> pointer_align_up(CapPtr<void, bounds> p)
|
inline CapPtr<T, bounds> pointer_align_up(CapPtr<void, bounds> p)
|
||||||
{
|
{
|
||||||
return CapPtr<T, bounds>::unsafe_from(
|
return CapPtr<T, bounds>::unsafe_from(
|
||||||
@@ -204,7 +204,7 @@ namespace snmalloc
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T = void, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<typename T = void, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
inline CapPtr<T, bounds>
|
inline CapPtr<T, bounds>
|
||||||
pointer_align_down(CapPtr<void, bounds> p, size_t alignment)
|
pointer_align_down(CapPtr<void, bounds> p, size_t alignment)
|
||||||
{
|
{
|
||||||
@@ -229,7 +229,7 @@ namespace snmalloc
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T = void, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<typename T = void, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
inline CapPtr<T, bounds>
|
inline CapPtr<T, bounds>
|
||||||
pointer_align_up(CapPtr<void, bounds> p, size_t alignment)
|
pointer_align_up(CapPtr<void, bounds> p, size_t alignment)
|
||||||
{
|
{
|
||||||
@@ -252,8 +252,8 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
typename T = void,
|
typename T = void,
|
||||||
typename U = void,
|
typename U = void,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) Tbounds,
|
SNMALLOC_CONCEPT(capptr::IsBound) Tbounds,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) Ubounds>
|
SNMALLOC_CONCEPT(capptr::IsBound) Ubounds>
|
||||||
inline size_t pointer_diff(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
|
inline size_t pointer_diff(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
|
||||||
{
|
{
|
||||||
return pointer_diff(base.unsafe_ptr(), cursor.unsafe_ptr());
|
return pointer_diff(base.unsafe_ptr(), cursor.unsafe_ptr());
|
||||||
@@ -272,8 +272,8 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
typename T = void,
|
typename T = void,
|
||||||
typename U = void,
|
typename U = void,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) Tbounds,
|
SNMALLOC_CONCEPT(capptr::IsBound) Tbounds,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) Ubounds>
|
SNMALLOC_CONCEPT(capptr::IsBound) Ubounds>
|
||||||
inline ptrdiff_t
|
inline ptrdiff_t
|
||||||
pointer_diff_signed(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
|
pointer_diff_signed(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace snmalloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Verify that a pointer points into the region managed by this config */
|
/* Verify that a pointer points into the region managed by this config */
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static SNMALLOC_FAST_PATH CapPtr<
|
static SNMALLOC_FAST_PATH CapPtr<
|
||||||
T,
|
T,
|
||||||
typename B::template with_wildness<capptr::dimension::Wildness::Tame>>
|
typename B::template with_wildness<capptr::dimension::Wildness::Tame>>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace snmalloc
|
namespace snmalloc
|
||||||
{
|
{
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) B = capptr::bounds::Arena>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) B = capptr::bounds::Arena>
|
||||||
class EmptyRange
|
class EmptyRange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
namespace snmalloc
|
namespace snmalloc
|
||||||
{
|
{
|
||||||
template<
|
template<size_t MIN_BITS, SNMALLOC_CONCEPT(capptr::IsBound) B, typename F>
|
||||||
size_t MIN_BITS,
|
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B,
|
|
||||||
typename F>
|
|
||||||
void range_to_pow_2_blocks(CapPtr<void, B> base, size_t length, F f)
|
void range_to_pow_2_blocks(CapPtr<void, B> base, size_t length, F f)
|
||||||
{
|
{
|
||||||
auto end = pointer_offset(base, length);
|
auto end = pointer_offset(base, length);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace snmalloc
|
|||||||
* struct for representing the redblack nodes
|
* struct for representing the redblack nodes
|
||||||
* directly inside the meta data.
|
* directly inside the meta data.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
struct FreeChunk
|
struct FreeChunk
|
||||||
{
|
{
|
||||||
CapPtr<FreeChunk, bounds> left;
|
CapPtr<FreeChunk, bounds> left;
|
||||||
@@ -20,7 +20,7 @@ namespace snmalloc
|
|||||||
/**
|
/**
|
||||||
* Class for using the allocations own space to store in the RBTree.
|
* Class for using the allocations own space to store in the RBTree.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
class BuddyInplaceRep
|
class BuddyInplaceRep
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace snmalloc
|
|||||||
* with that spelling. Both seem happy with this formulation.
|
* with that spelling. Both seem happy with this formulation.
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept ConceptBound =
|
concept IsBound =
|
||||||
ConceptSame<decltype(T::spatial), const dimension::Spatial> &&
|
ConceptSame<decltype(T::spatial), const dimension::Spatial> &&
|
||||||
ConceptSame<decltype(T::address_space_control),
|
ConceptSame<decltype(T::address_space_control),
|
||||||
const dimension::AddressSpaceControl> &&
|
const dimension::AddressSpaceControl> &&
|
||||||
@@ -236,7 +236,7 @@ namespace snmalloc
|
|||||||
* annotation. This is used by the PAL's capptr_to_user_address_control
|
* annotation. This is used by the PAL's capptr_to_user_address_control
|
||||||
* function to compute its return value's annotation.
|
* function to compute its return value's annotation.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
using user_address_control_type =
|
using user_address_control_type =
|
||||||
typename B::template with_address_space_control<
|
typename B::template with_address_space_control<
|
||||||
dimension::AddressSpaceControl::User>;
|
dimension::AddressSpaceControl::User>;
|
||||||
@@ -246,8 +246,8 @@ namespace snmalloc
|
|||||||
* Chunk and ChunkD are considered eqivalent here.
|
* Chunk and ChunkD are considered eqivalent here.
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BI,
|
SNMALLOC_CONCEPT(capptr::IsBound) BI,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BO>
|
SNMALLOC_CONCEPT(capptr::IsBound) BO>
|
||||||
SNMALLOC_CONSTEVAL bool is_spatial_refinement()
|
SNMALLOC_CONSTEVAL bool is_spatial_refinement()
|
||||||
{
|
{
|
||||||
if (BI::address_space_control != BO::address_space_control)
|
if (BI::address_space_control != BO::address_space_control)
|
||||||
@@ -268,7 +268,7 @@ namespace snmalloc
|
|||||||
* A pointer annotated with a "phantom type parameter" carrying a static
|
* A pointer annotated with a "phantom type parameter" carrying a static
|
||||||
* summary of its StrictProvenance metadata.
|
* summary of its StrictProvenance metadata.
|
||||||
*/
|
*/
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
class CapPtr
|
class CapPtr
|
||||||
{
|
{
|
||||||
T* unsafe_capptr;
|
T* unsafe_capptr;
|
||||||
@@ -446,7 +446,7 @@ namespace snmalloc
|
|||||||
/**
|
/**
|
||||||
* It's safe to mark any CapPtr as Wild.
|
* It's safe to mark any CapPtr as Wild.
|
||||||
*/
|
*/
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static inline SNMALLOC_FAST_PATH CapPtr<
|
static inline SNMALLOC_FAST_PATH CapPtr<
|
||||||
T,
|
T,
|
||||||
typename B::template with_wildness<capptr::dimension::Wildness::Wild>>
|
typename B::template with_wildness<capptr::dimension::Wildness::Wild>>
|
||||||
@@ -467,7 +467,7 @@ namespace snmalloc
|
|||||||
* annotations around an un-annotated std::atomic<T*>, to appease C++, yet
|
* annotations around an un-annotated std::atomic<T*>, to appease C++, yet
|
||||||
* will expose or consume only CapPtr<T> with the same bounds annotation.
|
* will expose or consume only CapPtr<T> with the same bounds annotation.
|
||||||
*/
|
*/
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
|
||||||
class AtomicCapPtr
|
class AtomicCapPtr
|
||||||
{
|
{
|
||||||
std::atomic<T*> unsafe_capptr;
|
std::atomic<T*> unsafe_capptr;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(IsConfigDomestication) Config,
|
SNMALLOC_CONCEPT(IsConfigDomestication) Config,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
constexpr SNMALLOC_FAST_PATH_INLINE auto has_domesticate(int)
|
constexpr SNMALLOC_FAST_PATH_INLINE auto has_domesticate(int)
|
||||||
-> std::enable_if_t<
|
-> std::enable_if_t<
|
||||||
std::is_same_v<
|
std::is_same_v<
|
||||||
@@ -65,7 +65,7 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(IsConfig) Config,
|
SNMALLOC_CONCEPT(IsConfig) Config,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
constexpr SNMALLOC_FAST_PATH_INLINE bool has_domesticate(long)
|
constexpr SNMALLOC_FAST_PATH_INLINE bool has_domesticate(long)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -80,7 +80,7 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(IsConfig) Config,
|
SNMALLOC_CONCEPT(IsConfig) Config,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
SNMALLOC_FAST_PATH_INLINE auto
|
SNMALLOC_FAST_PATH_INLINE auto
|
||||||
capptr_domesticate(typename Config::LocalState* ls, CapPtr<T, B> p)
|
capptr_domesticate(typename Config::LocalState* ls, CapPtr<T, B> p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ namespace snmalloc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue =
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue = capptr::bounds::AllocWild>
|
||||||
capptr::bounds::AllocWild>
|
|
||||||
class T;
|
class T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,13 +66,13 @@ namespace snmalloc
|
|||||||
* place. Give it a shorter name (Object::BQueuePtr<BQueue>) for
|
* place. Give it a shorter name (Object::BQueuePtr<BQueue>) for
|
||||||
* convenience.
|
* convenience.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
using BQueuePtr = CapPtr<Object::T<BQueue>, BQueue>;
|
using BQueuePtr = CapPtr<Object::T<BQueue>, BQueue>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As with BQueuePtr, but atomic.
|
* As with BQueuePtr, but atomic.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
using BAtomicQueuePtr = AtomicCapPtr<Object::T<BQueue>, BQueue>;
|
using BAtomicQueuePtr = AtomicCapPtr<Object::T<BQueue>, BQueue>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,16 +82,16 @@ namespace snmalloc
|
|||||||
* looks a little nicer than "CapPtr<freelist::Object::T<BQueue>, BView>".
|
* looks a little nicer than "CapPtr<freelist::Object::T<BQueue>, BView>".
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
using BHeadPtr = CapPtr<Object::T<BQueue>, BView>;
|
using BHeadPtr = CapPtr<Object::T<BQueue>, BView>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* As with BHeadPtr, but atomic.
|
* As with BHeadPtr, but atomic.
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
using BAtomicHeadPtr = AtomicCapPtr<Object::T<BQueue>, BView>;
|
using BAtomicHeadPtr = AtomicCapPtr<Object::T<BQueue>, BView>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,14 +111,14 @@ namespace snmalloc
|
|||||||
* require size to be threaded through, but would provide more OOB
|
* require size to be threaded through, but would provide more OOB
|
||||||
* detection.
|
* detection.
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
class T
|
class T
|
||||||
{
|
{
|
||||||
template<
|
template<
|
||||||
bool,
|
bool,
|
||||||
bool,
|
bool,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound),
|
SNMALLOC_CONCEPT(capptr::IsBound),
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound)>
|
SNMALLOC_CONCEPT(capptr::IsBound)>
|
||||||
friend class Builder;
|
friend class Builder;
|
||||||
|
|
||||||
friend class Object;
|
friend class Object;
|
||||||
@@ -139,7 +138,7 @@ namespace snmalloc
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView = typename BQueue::
|
SNMALLOC_CONCEPT(capptr::IsBound) BView = typename BQueue::
|
||||||
template with_wildness<capptr::dimension::Wildness::Tame>,
|
template with_wildness<capptr::dimension::Wildness::Tame>,
|
||||||
typename Domesticator>
|
typename Domesticator>
|
||||||
BHeadPtr<BView, BQueue>
|
BHeadPtr<BView, BQueue>
|
||||||
@@ -164,7 +163,7 @@ namespace snmalloc
|
|||||||
* Read the next pointer
|
* Read the next pointer
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView = typename BQueue::
|
SNMALLOC_CONCEPT(capptr::IsBound) BView = typename BQueue::
|
||||||
template with_wildness<capptr::dimension::Wildness::Tame>,
|
template with_wildness<capptr::dimension::Wildness::Tame>,
|
||||||
typename Domesticator>
|
typename Domesticator>
|
||||||
BHeadPtr<BView, BQueue>
|
BHeadPtr<BView, BQueue>
|
||||||
@@ -203,8 +202,8 @@ namespace snmalloc
|
|||||||
|
|
||||||
// Note the inverted template argument order, since BView is inferable.
|
// Note the inverted template argument order, since BView is inferable.
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue,
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView>
|
SNMALLOC_CONCEPT(capptr::IsBound) BView>
|
||||||
static BHeadPtr<BView, BQueue> make(CapPtr<void, BView> p)
|
static BHeadPtr<BView, BQueue> make(CapPtr<void, BView> p)
|
||||||
{
|
{
|
||||||
return p.template as_static<Object::T<BQueue>>();
|
return p.template as_static<Object::T<BQueue>>();
|
||||||
@@ -213,7 +212,7 @@ namespace snmalloc
|
|||||||
/**
|
/**
|
||||||
* A container-of operation to convert &f->next_object to f
|
* A container-of operation to convert &f->next_object to f
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static Object::T<BQueue>*
|
static Object::T<BQueue>*
|
||||||
from_next_ptr(CapPtr<Object::T<BQueue>, BQueue>* ptr)
|
from_next_ptr(CapPtr<Object::T<BQueue>, BQueue>* ptr)
|
||||||
{
|
{
|
||||||
@@ -225,7 +224,7 @@ namespace snmalloc
|
|||||||
/**
|
/**
|
||||||
* Involutive encryption with raw pointers
|
* Involutive encryption with raw pointers
|
||||||
*/
|
*/
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
inline static Object::T<BQueue>*
|
inline static Object::T<BQueue>*
|
||||||
code_next(address_t curr, Object::T<BQueue>* next, const FreeListKey& key)
|
code_next(address_t curr, Object::T<BQueue>* next, const FreeListKey& key)
|
||||||
{
|
{
|
||||||
@@ -265,8 +264,8 @@ namespace snmalloc
|
|||||||
* is likely (but not necessarily) Wild.
|
* is likely (but not necessarily) Wild.
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
inline static BQueuePtr<BQueue> encode_next(
|
inline static BQueuePtr<BQueue> encode_next(
|
||||||
address_t curr, BHeadPtr<BView, BQueue> next, const FreeListKey& key)
|
address_t curr, BHeadPtr<BView, BQueue> next, const FreeListKey& key)
|
||||||
{
|
{
|
||||||
@@ -290,8 +289,8 @@ namespace snmalloc
|
|||||||
* encapsulated within Object and we do not capture any of it statically.
|
* encapsulated within Object and we do not capture any of it statically.
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
inline static BHeadPtr<BView, BQueue> decode_next(
|
inline static BHeadPtr<BView, BQueue> decode_next(
|
||||||
address_t curr, BHeadPtr<BView, BQueue> next, const FreeListKey& key)
|
address_t curr, BHeadPtr<BView, BQueue> next, const FreeListKey& key)
|
||||||
{
|
{
|
||||||
@@ -300,8 +299,8 @@ namespace snmalloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static void assert_view_queue_bounds()
|
static void assert_view_queue_bounds()
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
@@ -326,8 +325,8 @@ namespace snmalloc
|
|||||||
* next->next_object is nullptr).
|
* next->next_object is nullptr).
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static BQueuePtr<BQueue>* store_next(
|
static BQueuePtr<BQueue>* store_next(
|
||||||
BQueuePtr<BQueue>* curr,
|
BQueuePtr<BQueue>* curr,
|
||||||
BHeadPtr<BView, BQueue> next,
|
BHeadPtr<BView, BQueue> next,
|
||||||
@@ -345,7 +344,7 @@ namespace snmalloc
|
|||||||
return &(next->next_object);
|
return &(next->next_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
template<SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static void store_null(BQueuePtr<BQueue>* curr, const FreeListKey& key)
|
static void store_null(BQueuePtr<BQueue>* curr, const FreeListKey& key)
|
||||||
{
|
{
|
||||||
*curr =
|
*curr =
|
||||||
@@ -358,8 +357,8 @@ namespace snmalloc
|
|||||||
* Uses the atomic view of next, so can be used in the message queues.
|
* Uses the atomic view of next, so can be used in the message queues.
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static void atomic_store_next(
|
static void atomic_store_next(
|
||||||
BHeadPtr<BView, BQueue> curr,
|
BHeadPtr<BView, BQueue> curr,
|
||||||
BHeadPtr<BView, BQueue> next,
|
BHeadPtr<BView, BQueue> next,
|
||||||
@@ -381,8 +380,8 @@ namespace snmalloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue>
|
||||||
static void
|
static void
|
||||||
atomic_store_null(BHeadPtr<BView, BQueue> curr, const FreeListKey& key)
|
atomic_store_null(BHeadPtr<BView, BQueue> curr, const FreeListKey& key)
|
||||||
{
|
{
|
||||||
@@ -428,8 +427,8 @@ namespace snmalloc
|
|||||||
* Checks signing of pointers
|
* Checks signing of pointers
|
||||||
*/
|
*/
|
||||||
template<
|
template<
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView = capptr::bounds::Alloc,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView = capptr::bounds::Alloc,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue = capptr::bounds::AllocWild>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue = capptr::bounds::AllocWild>
|
||||||
class Iter
|
class Iter
|
||||||
{
|
{
|
||||||
Object::BHeadPtr<BView, BQueue> curr{nullptr};
|
Object::BHeadPtr<BView, BQueue> curr{nullptr};
|
||||||
@@ -508,8 +507,8 @@ namespace snmalloc
|
|||||||
template<
|
template<
|
||||||
bool RANDOM,
|
bool RANDOM,
|
||||||
bool INIT = true,
|
bool INIT = true,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BView = capptr::bounds::Alloc,
|
SNMALLOC_CONCEPT(capptr::IsBound) BView = capptr::bounds::Alloc,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) BQueue = capptr::bounds::AllocWild>
|
SNMALLOC_CONCEPT(capptr::IsBound) BQueue = capptr::bounds::AllocWild>
|
||||||
class Builder
|
class Builder
|
||||||
{
|
{
|
||||||
static constexpr size_t LENGTH = RANDOM ? 2 : 1;
|
static constexpr size_t LENGTH = RANDOM ? 2 : 1;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace snmalloc
|
|||||||
typename PAL = DefaultPal,
|
typename PAL = DefaultPal,
|
||||||
typename AAL = Aal,
|
typename AAL = Aal,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static inline typename std::enable_if_t<
|
static inline typename std::enable_if_t<
|
||||||
!aal_supports<StrictProvenance, AAL>,
|
!aal_supports<StrictProvenance, AAL>,
|
||||||
CapPtr<T, capptr::user_address_control_type<B>>>
|
CapPtr<T, capptr::user_address_control_type<B>>>
|
||||||
@@ -98,7 +98,7 @@ namespace snmalloc
|
|||||||
typename PAL = DefaultPal,
|
typename PAL = DefaultPal,
|
||||||
typename AAL = Aal,
|
typename AAL = Aal,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static SNMALLOC_FAST_PATH typename std::enable_if_t<
|
static SNMALLOC_FAST_PATH typename std::enable_if_t<
|
||||||
aal_supports<StrictProvenance, AAL>,
|
aal_supports<StrictProvenance, AAL>,
|
||||||
CapPtr<T, capptr::user_address_control_type<B>>>
|
CapPtr<T, capptr::user_address_control_type<B>>>
|
||||||
@@ -119,7 +119,7 @@ namespace snmalloc
|
|||||||
typename PAL,
|
typename PAL,
|
||||||
bool page_aligned = false,
|
bool page_aligned = false,
|
||||||
typename T,
|
typename T,
|
||||||
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static SNMALLOC_FAST_PATH void pal_zero(CapPtr<T, B> p, size_t sz)
|
static SNMALLOC_FAST_PATH void pal_zero(CapPtr<T, B> p, size_t sz)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace snmalloc
|
|||||||
* manage the address space it references by clearing the SW_VMEM
|
* manage the address space it references by clearing the SW_VMEM
|
||||||
* permission bit.
|
* permission bit.
|
||||||
*/
|
*/
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static SNMALLOC_FAST_PATH CapPtr<T, capptr::user_address_control_type<B>>
|
static SNMALLOC_FAST_PATH CapPtr<T, capptr::user_address_control_type<B>>
|
||||||
capptr_to_user_address_control(CapPtr<T, B> p)
|
capptr_to_user_address_control(CapPtr<T, B> p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace snmalloc
|
|||||||
static inline uintptr_t domesticate_patch_value;
|
static inline uintptr_t domesticate_patch_value;
|
||||||
|
|
||||||
/* Verify that a pointer points into the region managed by this config */
|
/* Verify that a pointer points into the region managed by this config */
|
||||||
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
|
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
|
||||||
static CapPtr<
|
static CapPtr<
|
||||||
T,
|
T,
|
||||||
typename B::template with_wildness<capptr::dimension::Wildness::Tame>>
|
typename B::template with_wildness<capptr::dimension::Wildness::Tame>>
|
||||||
|
|||||||
Reference in New Issue
Block a user