File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -483,7 +483,7 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY)
483483 # These are mitigation-independent and can be compiled once, then linked
484484 # against both fast and check testlib variants.
485485 set (TESTLIB_ONLY_TESTS
486- bits first_operation memory_usage multi_atexit multi_threadatexit
486+ bits first_operation memory memory_usage multi_atexit multi_threadatexit
487487 redblack statistics teardown
488488 contention external_pointer large_alloc lotsofthreads post_teardown
489489 singlethread startup
Original file line number Diff line number Diff line change @@ -151,6 +151,12 @@ namespace snmalloc
151151 return snmalloc::remaining_bytes (sizeclass, p);
152152 }
153153
154+ template <SNMALLOC_CONCEPT(IsConfig) Config_ = Config>
155+ size_t SNMALLOC_FAST_PATH_INLINE remaining_bytes (const void * p)
156+ {
157+ return remaining_bytes<Config_>(address_cast (p));
158+ }
159+
154160 /* *
155161 * Returns the byte offset into an object.
156162 *
Original file line number Diff line number Diff line change 11#include < array>
22#include < chrono>
33#include < iostream>
4- #include < snmalloc/ds_aal/ds_aal.h>
54#include < test/opt.h>
65#include < test/setup.h>
76#include < test/snmalloc_testlib.h>
@@ -494,8 +493,7 @@ void test_remaining_bytes()
494493 char * p = (char *)snmalloc::alloc (size);
495494 for (size_t offset = 0 ; offset < size; offset++)
496495 {
497- auto rem = snmalloc::remaining_bytes (
498- address_cast (pointer_offset (p, offset)));
496+ auto rem = snmalloc::remaining_bytes (pointer_offset (p, offset));
499497 if (rem != (size - offset))
500498 {
501499 if (rem < (size - offset) || snmalloc::is_owned (p))
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ namespace snmalloc
5858 return alloc_size<Config>(p);
5959 }
6060
61- size_t remaining_bytes (address_t p)
61+ size_t remaining_bytes (const void * p)
6262 {
6363 return remaining_bytes<Config>(p);
6464 }
Original file line number Diff line number Diff line change 2222
2323namespace snmalloc
2424{
25- // Forward declarations sufficient for the API surface.
26- // address_t: uintptr_t on all non-CHERI platforms.
27- using address_t = uintptr_t ;
28-
2925 template <ZeroMem>
3026 class DefaultConts ;
3127 // Uninit / Zero are usable as template arguments even without the full
@@ -55,7 +51,7 @@ namespace snmalloc
5551
5652 // -- Non-template wrappers for Config-templated functions ----------------
5753 size_t alloc_size (const void * p);
58- size_t remaining_bytes (address_t p);
54+ size_t remaining_bytes (const void * p);
5955 bool is_owned (void * p);
6056 void debug_check_empty (bool * result = nullptr );
6157 void debug_in_use (size_t count);
You can’t perform that action at this time.
0 commit comments