find_program can do that for us. Additionally that loop was resetting
the CLANG_FORMAT every time ninja was run, making it impossible to
pass a specific -DCLANG_FORMAT=... to cmake.
I've tried version 6 to 8 and formatting remains stable. clang 9 is
when it breaks down because of AfterCaseLabel.
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>
If some tests on Windows are co-scheduled, then they run out of commit
space and crash. For example, in func-memory,
test_external_pointer_large can cause the small CI machines to run out
of commit space on Windows.
Make header only library target.
Use the CMake INTERFACE target type to include the build settings for
snmalloc in other projects using headers only.
Made warnings setting a macro for reuse.
- Don't run an expensive functionality test in debug builds.
- Don't run the different cache configurations (they're probably going
away soon because they help only in synthetic benchmarks).
The newer API (Windows 10 and newer) allows the allocator to ask for
strongly aligned memory.
This is enabled only if the `WINVER` macro is set to target Windows 10
or newer. There is now a CMake option to target older versions of
Windows, so we can test both code paths.
The Azure Pipelines config now includes a test of the compatibility
version. This runs only the release build, because it's mainly there as
a sanity check - 99% of the code is the same as the default Windows
config.
Only the malloc/free/... interface is exported.
This allows all of C++'s weak ODR symbols to be resolved at
compile-time, rather than staying weak and resolved at load-time.
Since internal calls don't need to go through the PLT anymore, we get a
nice speedup, at least on small objects.
RTTI makes the binaries bigger, exceptions make life harder for
optimisers. Neither are actually used.
This doesn't preclude anything #including snmalloc.h with RTTI enabled,
it just disables it in the shim libraries and tests.
The FreeBSD libc builds were already doing this with no ill effect.
The encoding in the top bits for the size class did not respect kernel
pointers. Using an intptr_t means, we can use a signed shift to
maintain the kernel pointers.