Skip to content

Commit b2c75df

Browse files
committed
NFC: rename ConceptBound to IsBound
1 parent df1dbc9 commit b2c75df

File tree

14 files changed

+69
-73
lines changed

14 files changed

+69
-73
lines changed

docs/StrictProvenance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ We introduce a multi-dimensional space of bounds. The facets are `enum class`-e
175175
* `Wildness` captures whether the pointer has been checked to belong to this allocator.
176176

177177
These `dimension`s are composited using a `capptr::bound<>` type that we use as `B` in `CapPtr<T, B>`.
178-
This is enforced (loosely) using the `ConceptBound` C++20 concept.
178+
This is enforced (loosely) using the `IsBound` C++20 concept.
179179

180180
The namespace `snmalloc::capptr::bounds` contains particular points in the space of `capptr::bound<>` types:
181181

src/snmalloc/aal/aal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ namespace snmalloc
198198
*/
199199
template<
200200
typename T,
201-
SNMALLOC_CONCEPT(capptr::ConceptBound) BOut,
202-
SNMALLOC_CONCEPT(capptr::ConceptBound) BIn,
201+
SNMALLOC_CONCEPT(capptr::IsBound) BOut,
202+
SNMALLOC_CONCEPT(capptr::IsBound) BIn,
203203
typename U = T>
204204
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
205205
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept

src/snmalloc/aal/aal_cheri.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ namespace snmalloc
6363

6464
template<
6565
typename T,
66-
SNMALLOC_CONCEPT(capptr::ConceptBound) BOut,
67-
SNMALLOC_CONCEPT(capptr::ConceptBound) BIn,
66+
SNMALLOC_CONCEPT(capptr::IsBound) BOut,
67+
SNMALLOC_CONCEPT(capptr::IsBound) BIn,
6868
typename U = T>
6969
static SNMALLOC_FAST_PATH CapPtr<T, BOut>
7070
capptr_bound(CapPtr<U, BIn> a, size_t size) noexcept

src/snmalloc/aal/address.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace snmalloc
3030
unsafe_to_uintptr<T>(base) + static_cast<uintptr_t>(diff));
3131
}
3232

33-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds, typename T>
33+
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
3434
inline CapPtr<void, bounds>
3535
pointer_offset(CapPtr<T, bounds> base, size_t diff)
3636
{
@@ -48,7 +48,7 @@ namespace snmalloc
4848
return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + diff);
4949
}
5050

51-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds, typename T>
51+
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds, typename T>
5252
inline CapPtr<void, bounds>
5353
pointer_offset_signed(CapPtr<T, bounds> base, ptrdiff_t diff)
5454
{
@@ -72,7 +72,7 @@ namespace snmalloc
7272
* as per above, and uses the wrapper types in its own definition, e.g., of
7373
* capptr_bound.
7474
*/
75-
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
75+
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
7676
inline SNMALLOC_FAST_PATH address_t address_cast(CapPtr<T, bounds> a)
7777
{
7878
return address_cast(a.unsafe_ptr());
@@ -136,7 +136,7 @@ namespace snmalloc
136136
template<
137137
size_t alignment,
138138
typename T,
139-
SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
139+
SNMALLOC_CONCEPT(capptr::IsBound) bounds>
140140
inline CapPtr<T, bounds> pointer_align_down(CapPtr<void, bounds> p)
141141
{
142142
return CapPtr<T, bounds>::unsafe_from(
@@ -174,7 +174,7 @@ namespace snmalloc
174174
template<
175175
size_t alignment,
176176
typename T = void,
177-
SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
177+
SNMALLOC_CONCEPT(capptr::IsBound) bounds>
178178
inline CapPtr<T, bounds> pointer_align_up(CapPtr<void, bounds> p)
179179
{
180180
return CapPtr<T, bounds>::unsafe_from(
@@ -204,7 +204,7 @@ namespace snmalloc
204204
#endif
205205
}
206206

207-
template<typename T = void, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
207+
template<typename T = void, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
208208
inline CapPtr<T, bounds>
209209
pointer_align_down(CapPtr<void, bounds> p, size_t alignment)
210210
{
@@ -229,7 +229,7 @@ namespace snmalloc
229229
#endif
230230
}
231231

232-
template<typename T = void, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
232+
template<typename T = void, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
233233
inline CapPtr<T, bounds>
234234
pointer_align_up(CapPtr<void, bounds> p, size_t alignment)
235235
{
@@ -252,8 +252,8 @@ namespace snmalloc
252252
template<
253253
typename T = void,
254254
typename U = void,
255-
SNMALLOC_CONCEPT(capptr::ConceptBound) Tbounds,
256-
SNMALLOC_CONCEPT(capptr::ConceptBound) Ubounds>
255+
SNMALLOC_CONCEPT(capptr::IsBound) Tbounds,
256+
SNMALLOC_CONCEPT(capptr::IsBound) Ubounds>
257257
inline size_t pointer_diff(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
258258
{
259259
return pointer_diff(base.unsafe_ptr(), cursor.unsafe_ptr());
@@ -272,8 +272,8 @@ namespace snmalloc
272272
template<
273273
typename T = void,
274274
typename U = void,
275-
SNMALLOC_CONCEPT(capptr::ConceptBound) Tbounds,
276-
SNMALLOC_CONCEPT(capptr::ConceptBound) Ubounds>
275+
SNMALLOC_CONCEPT(capptr::IsBound) Tbounds,
276+
SNMALLOC_CONCEPT(capptr::IsBound) Ubounds>
277277
inline ptrdiff_t
278278
pointer_diff_signed(CapPtr<T, Tbounds> base, CapPtr<U, Ubounds> cursor)
279279
{

src/snmalloc/backend/fixedglobalconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace snmalloc
8787
}
8888

8989
/* Verify that a pointer points into the region managed by this config */
90-
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
90+
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
9191
static SNMALLOC_FAST_PATH CapPtr<
9292
T,
9393
typename B::template with_wildness<capptr::dimension::Wildness::Tame>>

src/snmalloc/backend_helpers/empty_range.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace snmalloc
55
{
6-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) B = capptr::bounds::Arena>
6+
template<SNMALLOC_CONCEPT(capptr::IsBound) B = capptr::bounds::Arena>
77
class EmptyRange
88
{
99
public:

src/snmalloc/backend_helpers/range_helpers.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
namespace snmalloc
66
{
7-
template<
8-
size_t MIN_BITS,
9-
SNMALLOC_CONCEPT(capptr::ConceptBound) B,
10-
typename F>
7+
template<size_t MIN_BITS, SNMALLOC_CONCEPT(capptr::IsBound) B, typename F>
118
void range_to_pow_2_blocks(CapPtr<void, B> base, size_t length, F f)
129
{
1310
auto end = pointer_offset(base, length);

src/snmalloc/backend_helpers/smallbuddyrange.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace snmalloc
1010
* struct for representing the redblack nodes
1111
* directly inside the meta data.
1212
*/
13-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
13+
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds>
1414
struct FreeChunk
1515
{
1616
CapPtr<FreeChunk, bounds> left;
@@ -20,7 +20,7 @@ namespace snmalloc
2020
/**
2121
* Class for using the allocations own space to store in the RBTree.
2222
*/
23-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
23+
template<SNMALLOC_CONCEPT(capptr::IsBound) bounds>
2424
class BuddyInplaceRep
2525
{
2626
public:

src/snmalloc/ds_core/ptrwrap.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ namespace snmalloc
175175
* with that spelling. Both seem happy with this formulation.
176176
*/
177177
template<typename T>
178-
concept ConceptBound =
178+
concept IsBound =
179179
ConceptSame<decltype(T::spatial), const dimension::Spatial> &&
180180
ConceptSame<decltype(T::address_space_control),
181181
const dimension::AddressSpaceControl> &&
@@ -236,7 +236,7 @@ namespace snmalloc
236236
* annotation. This is used by the PAL's capptr_to_user_address_control
237237
* function to compute its return value's annotation.
238238
*/
239-
template<SNMALLOC_CONCEPT(capptr::ConceptBound) B>
239+
template<SNMALLOC_CONCEPT(capptr::IsBound) B>
240240
using user_address_control_type =
241241
typename B::template with_address_space_control<
242242
dimension::AddressSpaceControl::User>;
@@ -246,8 +246,8 @@ namespace snmalloc
246246
* Chunk and ChunkD are considered eqivalent here.
247247
*/
248248
template<
249-
SNMALLOC_CONCEPT(capptr::ConceptBound) BI,
250-
SNMALLOC_CONCEPT(capptr::ConceptBound) BO>
249+
SNMALLOC_CONCEPT(capptr::IsBound) BI,
250+
SNMALLOC_CONCEPT(capptr::IsBound) BO>
251251
SNMALLOC_CONSTEVAL bool is_spatial_refinement()
252252
{
253253
if (BI::address_space_control != BO::address_space_control)
@@ -268,7 +268,7 @@ namespace snmalloc
268268
* A pointer annotated with a "phantom type parameter" carrying a static
269269
* summary of its StrictProvenance metadata.
270270
*/
271-
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
271+
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
272272
class CapPtr
273273
{
274274
T* unsafe_capptr;
@@ -446,7 +446,7 @@ namespace snmalloc
446446
/**
447447
* It's safe to mark any CapPtr as Wild.
448448
*/
449-
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
449+
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) B>
450450
static inline SNMALLOC_FAST_PATH CapPtr<
451451
T,
452452
typename B::template with_wildness<capptr::dimension::Wildness::Wild>>
@@ -467,7 +467,7 @@ namespace snmalloc
467467
* annotations around an un-annotated std::atomic<T*>, to appease C++, yet
468468
* will expose or consume only CapPtr<T> with the same bounds annotation.
469469
*/
470-
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) bounds>
470+
template<typename T, SNMALLOC_CONCEPT(capptr::IsBound) bounds>
471471
class AtomicCapPtr
472472
{
473473
std::atomic<T*> unsafe_capptr;

src/snmalloc/mem/backend_wrappers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace snmalloc
4242
template<
4343
SNMALLOC_CONCEPT(IsConfigDomestication) Config,
4444
typename T,
45-
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
45+
SNMALLOC_CONCEPT(capptr::IsBound) B>
4646
constexpr SNMALLOC_FAST_PATH_INLINE auto has_domesticate(int)
4747
-> std::enable_if_t<
4848
std::is_same_v<
@@ -65,7 +65,7 @@ namespace snmalloc
6565
template<
6666
SNMALLOC_CONCEPT(IsConfig) Config,
6767
typename T,
68-
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
68+
SNMALLOC_CONCEPT(capptr::IsBound) B>
6969
constexpr SNMALLOC_FAST_PATH_INLINE bool has_domesticate(long)
7070
{
7171
return false;
@@ -80,7 +80,7 @@ namespace snmalloc
8080
template<
8181
SNMALLOC_CONCEPT(IsConfig) Config,
8282
typename T,
83-
SNMALLOC_CONCEPT(capptr::ConceptBound) B>
83+
SNMALLOC_CONCEPT(capptr::IsBound) B>
8484
SNMALLOC_FAST_PATH_INLINE auto
8585
capptr_domesticate(typename Config::LocalState* ls, CapPtr<T, B> p)
8686
{

0 commit comments

Comments
 (0)