Commit Graph

149 Commits

Author SHA1 Message Date
David Chisnall
c673926d15 Add missing const.
No idea why this only raised an error with cl.exe, it was wrong on all
platforms.
2019-04-10 13:13:09 +01:00
David Chisnall
6f19d4e1e7 Bump the clang-format version to 7.
6 inserts some whitespace that 7 doesn't.
2019-04-10 13:09:55 +01:00
David Chisnall
ad0a22e571 Add missing doc comments. 2019-04-10 12:49:02 +01:00
David Chisnall
2442dc4f3f [NFI] clang-format 2019-04-10 12:43:04 +01:00
David Chisnall
d0fefb8641 Don't always refer to the global pagemap.
If you're creating a new allocator and the pagemap comes from a library
that exports the pagemap accessor function but not the pagemap symbol,
you need to be able to replace this.
2019-04-10 11:57:02 +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
David Chisnall
a93f43fd2f Add some type safety to other pagemap accesses.
Introduce a descriptor for the pagemap config and check that the source
descriptor is compatible with the destination type.
2019-04-09 15:52:38 +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
869b22b422 Sort test order so that perf tests start first.
These take longer, so we want to start them earlier and let the shorter
tests fill in the gaps in scheduling.
2019-02-25 16:33:57 +00:00
David Chisnall
25c365682e Pipeline names can't contain spaces. 2019-02-25 16:33:57 +00:00
David Chisnall
11ccf365d3 Move LD_PRELOAD to a separate test.
The Linux Debug build is currently one of the slowest two, pull out one
phase of it that is independent and allow it to run in parallel with the
other tests.
2019-02-25 16:33:57 +00:00
David Chisnall
ef50a0282b Attempt to make CI faster.
- 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).
2019-02-25 16:33:57 +00:00
David Chisnall
7f576c74d6 Update docs to mention macOS. 2019-02-25 16:33:57 +00:00
David Chisnall
feb77ac6c6 Split compile and test CI phases. 2019-02-25 16:33:57 +00:00
David Chisnall
45a31e75d1 Add some comments. 2019-02-25 12:54:16 +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
aab4de7bc9 First attempt at adding macOS to CI. 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
d6e89b7c60 Fix Matt's code review comments. 2019-02-25 11:27:53 +00:00
David Chisnall
01bd77b356 Remove some ugly templated things.
Replace them with some very simple constexpr things.  This is what the
code used to look like, but it appears that I fundamentally
misunderstood why it didn't work.  This version should be a lot more
maintainable.
2019-02-25 11:27:53 +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
4036e54879 [NFC] clang-format. 2019-02-25 11:27:53 +00:00
David Chisnall
1892538ad1 Clean up PAL feature detection API. 2019-02-25 11:27:53 +00:00
David Chisnall
5adba34d60 Make clang 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
80630a359f Clean up interface to the low memory notifications.
- Rename MemoryProviderState to PAL to reflect what is now is.
 - Hide calls to the PAL's low memory functions behind something that
   returns a default value if they're not implemented.
2019-02-25 11:27:53 +00:00
David Chisnall
e2a12802d5 Hide the low memory notification PAL code. 2019-02-25 11:27:53 +00:00
David Chisnall
f6349092c9 Remove debugging define.
This was enabled so CI would run it.  It probably should be enabled for
some testing, but via CMake, not like this.
2019-02-25 11:27:53 +00:00
David Chisnall
6af4c97726 Explicitly qualify a method.
Either clang or cl has a bug: cl accepts the unqualified (inherited)
method name, clang rejects it.  Both accept the qualified name.
2019-02-25 11:27:53 +00:00
David Chisnall
71cfb6da1e [NFC] clangformat 2019-02-25 11:27:53 +00:00
David Chisnall
e5d330ec7a Fix the tests. 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
6ec84856df Merge pull request #28 from Microsoft/mpscq
Updated to match documentation.
2019-02-19 16:22:00 +00:00
Matthew Parkinson
9940fbd363 Fixed typo. 2019-02-19 15:44:23 +00:00
Matthew Parkinson
d588e8ecb1 Updated to match documentation. 2019-02-19 15:00:55 +00:00
Matthew Parkinson
ccccd686fb Merge pull request #16 from Microsoft/Sizeclass
Simplified sizeclass calculations and added tests.
2019-02-19 13:07:08 +00:00
Matthew Parkinson
aac2b9212e Merge pull request #21 from plietar/smart-next
Place the next pointer at a different place on every object.
2019-02-19 09:04:23 +00:00
Paul Liétar
ffe496dd18 Address review comments. 2019-02-18 21:29:32 +00:00
Paul Liétar
66400af419 Add a cache-friendly version of the tests.
This only tests CACHE_FRIENDLY_OFFSET=64, which is probably what we'll be using in the end.
2019-02-18 14:51:04 +00:00
Paul Liétar
4ac3421487 Place the next pointer at a different place on every object.
This limits the collision in cache buckets, especially for larger objects.
2019-02-18 14:22:50 +00:00
David Chisnall
c47eed1922 Tweaks to end bounds checking.
Introduce a `OnePastEnd` option for the pointer immediately after the
end of the allocation.  This simplifies some of the logic in callers,
where they wants to say 'is base + length safe to use?'.

Also restructure some of the other logic somewhat.
2019-02-15 20:05:00 +01:00