The performance on Windows was significantly regressed by the
notify_using during the bump allocation. This change removes that.
It appears that the pages are already committed by
the large allocator.
Fixes a few places where Clang complains about Windows specific code,
and also uses macros supported by Clang on Windows. A few places
separating platform and compiler specific code, as MSVC and WIN32 were
used interchangably previously.
* add rust support
* move aligned_size to sizeclass.h
* add static qualifier
* adjust CMakeLists.txt, may broke CI tests
* fix msvc's complaining on c++17
* use SNMALLOC_FAST_PATH as the decorator of aligned_size
* adapt new alignment algorithm and add related test
Co-authored-by: mjp41 <mattpark@microsoft.com>
* fix test cases for msvc
* add extra test for size == 0
* treat memory block of same sizeclass as the same
* fix formatting problem
* remove extra declarations
Co-authored-by: Matthew Parkinson <mjp41@users.noreply.github.com>
For languages like Verona or Rust, the deallocation calls know the
size of the object originally requested. This change optimises that
code path to create a much better fast path.
Previous implementation of aligned_alloc met the specification, but was
not particularly useful. This uses the same implementation for
alligned_alloc and memalign.
For architectures that can't manipulate pointers like integers, don't
try XORing them like this. It's not ideal -- perhaps we should have
"else" branches to these tests.
`load` does not load (`read` and `compare_exchange` do) so give it a
different name. For the cases where `ptr` was previously the pointer we
were guarding, rename it to `raw`.
If the test happens as uintptr_t on CHERI, then we attempt to construct
a capability and use a capability-based test rather than an
integer-based one, and things go south.
posix_memalign requires that the alignment parameter be a multiple of
sizeof(uintptr_t), but the test begins with alignments as small as
sizeof(size_t). While those are very likely the same value out in the
wild right now, they're not on CHERI.
Begin the test loop at sizeof(uintptr_t) and add a test that a request
for a reasonable amount of memory but with an alignment of
sizeof(uintptr_t)/2 fails with EINVAL.