Commit Graph

25 Commits

Author SHA1 Message Date
David Chisnall
785766b129 Move constants into the right file.
Document them while we're moving them.
2019-04-11 16:57:12 +01:00
David Chisnall
607573bb28 Add missing #pragma once to pal_consts.h
If you're defining a new PAL then you need to include this file twice.
2019-04-10 11:56:07 +01:00
rschust
51fbdf3a44 ZeroMem should not be a part of pal_consts.h 2019-04-09 13:56:22 +01:00
rschust
71900ef947 Created pal_consts.h. New exported functions are now prefixed with "snmalloc_". 2019-04-09 13:56:22 +01:00
rschust
f0d18760fe Exporting the global pagemap and the default memory provider's reserve function in order to support shared allocators 2019-04-09 13:56:22 +01:00
David Chisnall
a4dd814f6e [NFC] Clang-format. 2019-02-26 16:56:40 +00:00
David Chisnall
9ab0eef85a Restore accidentally deleted variables. 2019-02-26 16:56:40 +00:00
David Chisnall
e371edf11e Attempt at an Apple PAL.
Totally untested, but now we have macOS CI we can test there...
2019-02-25 12:54:16 +00:00
David Chisnall
6a5359b177 Pull aligned allocation out of the PAL.
The PAL can now advertise that it supports aligned allocation.  If it
does not, then the memory provider will do the alignment for it.

This change still leaves the PAL responsible for systematic testing, but
it should now be much easier to lift that out.
2019-02-25 12:54:16 +00:00
David Chisnall
f178028640 [NFC] clang-format again.
It appears that clang-format 6 (which CI uses) removes a newline that
clang-format 7 doesn't, but will also not add.  The new formatting
should keep 6 and 7 both happy.
2019-02-25 11:27:53 +00:00
David Chisnall
a24e6270cc Provide a generic PAL feature detection mechanism.
We can support up to 64 optional features, currently only one is used.
2019-02-25 11:27:53 +00:00
David Chisnall
66cec23b23 Initial cut at a lazy decommit strategy.
This does not deallocate memory until the OS tells us that we are short
on memory, then tries to decommit all of the cached chunks (except for
the first page, used for the linked lists).

Nowhere near enough testing to commit to master yet!
2019-02-25 11:27:53 +00:00
Matthew Parkinson
7a9ce97166 Clangformat 2019-02-20 17:36:39 +01:00
Matthew Parkinson
9104f81285 Remove Undefined preprocessor behaviour 2019-02-20 17:36:39 +01:00
Matthew Parkinson
98dd9573c7 Fix ifdef 2019-02-20 17:36:39 +01:00
David Chisnall
4830bd4021 Check for an SDK version before enabling VirtualAlloc2.
This is mainly to keep the CI system happy: it's using an old SDK
because the new version of cl.exe doesn't work with cmake...
2019-02-20 17:36:39 +01:00
David Chisnall
2ee3ba59ee Use VirtualAlloc2 on Windows.
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.
2019-02-20 17:36:39 +01:00
Matthew Parkinson
8698f87018 Added some constexpr to some ifs. 2019-02-15 16:12:38 +00:00
Theo Butler
c555bf7218 fix doc comments for notify_using 2019-02-13 17:15:06 -05:00
David Chisnall
264761adb9 Fix missing semicolon 2019-01-18 16:17:52 +00:00
Matthew Parkinson
07b19d43cb Merge pull request #4 from Microsoft/fbsdlibc
Merge changes required for using snmalloc in FreeBSD libc
2019-01-18 16:08:51 +00:00
David Chisnall
c3d46a9d8e Address review comments.
Move slow_allocator into a separate header in the snmalloc namespace and
rename it for consistency with the rest of the codebase.  Delete its
copy and move constructors / assignment operators.
2019-01-18 15:57:28 +00:00
Matthew Parkinson
0b57ff3667 Code Tidy
Remove explicit constructor as it is implicit.
2019-01-17 14:38:47 +00:00
David Chisnall
1324279eb5 Added some missing #includes. 2019-01-16 17:17:51 +00:00
Matthew Parkinson
4f9d991449 Initial commit of snmalloc
History squashed from internal development.

Internal history has commit hash:
  e27a0e485c44a5003a802de2661ce3b21e120316
2019-01-15 14:17:55 +00:00