Commit Graph

63 Commits

Author SHA1 Message Date
Nathaniel Filardo
44f80c00fc pal_open_enclave: use pointers, not uintptr_t 2019-11-26 15:50:22 +00:00
Nathaniel Filardo
20e804728b Move bits::is_aligned_block to address.h
And chase consequences
2019-11-26 15:33:09 +00:00
David Chisnall
31941eac06 Add explicit qualification.
Calling a superclass method requires explicit qualification when the
superclass is a templated class.
2019-11-18 13:16:51 +00:00
David Carlier
281a88d404 Templatize the Tag ID value 2019-08-27 13:10:50 +00:00
David Carlier
eed50baf8e Little tweaks 2019-08-27 10:42:57 +00:00
David Carlier
c881429e2e Using the macro instead 2019-08-27 10:20:16 +00:00
David Carlier
24ae5d704e darwin: override zero/non zeroed pages to tag them. 2019-08-26 18:57:45 +01:00
Matthew Parkinson
4827b7615b Fix inline statics in Pal_Windows. 2019-08-15 11:38:45 +01:00
David Chisnall
6dbe24da2e [NFC] Replace HEADER_GLOBAL with inline (C++17).
HEADER_GLOBAL was using non-standard attributes to achieve what C++17
now permits with a keyword.  Use the standard formulation.

Update the README to note that gcc is still not recommended, but because
of its poor codegen for 128-bit atomic compare and exchange, rather than
because it doesn't support the attribute used for HEADER_GLOBAL.
2019-08-13 17:30:37 +01:00
David Chisnall
b1e4146239 Remove leftover (incorrect) conditional compilation. 2019-08-01 15:31:21 +01:00
David Chisnall
84140722fa Fix typo in NetBSD PAL. 2019-08-01 14:57:15 +01:00
David Chisnall
d24ad45abe [NFC] clangformat. 2019-08-01 12:03:35 +01:00
David Chisnall
81a0f0aed8 [NFC] Remove one more unneeded include. 2019-08-01 11:50:35 +01:00
David Chisnall
d11f09e4ec [NFC] Remove incorrect guard and some unused includes. 2019-08-01 11:50:27 +01:00
David Chisnall
896cc9cf6f [NFC] Rename some PALs to make the naming more consistent. 2019-08-01 11:44:09 +01:00
David Chisnall
2b44b6b5ea Add a NetBSD PAL.
Currently untested, but identical to the FreeBSD one so should work...
The NetBSD man pages for `madvise` and `mmap` mention the flags that we
use.
2019-08-01 11:41:08 +01:00
David Chisnall
fd88b8464b [NFC] Separate out support for aligned allocation from the FreeBSD PAL.
NetBSD also supports `MAP_ALIGNED()` in `mmap` (according to the man
page, at least).
2019-08-01 11:39:26 +01:00
David Chisnall
cf6fca6514 [NFC] Make the Apple PAL use the generic BSD code. 2019-08-01 11:21:32 +01:00
David Chisnall
54cbf8b2bb [NFC] Remove unused headers from OpenBSD PAL. 2019-08-01 11:21:28 +01:00
David Chisnall
0497993d23 Fix typo in OpenBSD PAL. 2019-08-01 11:20:05 +01:00
David Chisnall
d257f60731 [NFC] Add missing doc comments. 2019-08-01 11:03:22 +01:00
David Chisnall
4ed15def79 [NFC] Remove some code duplication in the PALs.
Pull out a generic POSIX PAL as a superclass for the Linux and generic
BSD PALs.  Now we have FreeBSD and Linux adding OS-specific behaviour,
OpenBSD as a named subclass of the generic BSD PAL that doesn't add any
behaviour.

I believe a NetBSD PAL should now be identical to the OpenBSD one -
patches welcome if anyone wants to test one!
2019-08-01 10:56:13 +01:00
David Carlier
fdae3b451f Creating base class instead used by both platforms. 2019-07-31 10:27:35 +00:00
David Carlier
6b4ff3e7ab Basic OpenBSD backend support.
Cannot enforce alignment so we just check its correctness.
2019-07-30 20:58:38 +01:00
Matthew Parkinson
45f47499c5 Improved pal_supports 2019-07-10 20:11:05 +01:00
Matthew Parkinson
e240dd279a Use FlatPageMap on OS with lazy commit
If the operating system will allocate private pages on demand for the
pagemap then use the FlatPageMap by default as it generates better code
for deallocation.
2019-07-10 20:11:03 +01:00
David Chisnall
896b248c8c Fix undefined behaviour in FreeBSD PAL.
We were passing an argument less than 4K to the MAP_ALIGNED macro, which
caused an undefined shift.  The compiler helpfully propagated the undef
values back to earlier in the code and gave us some exciting nonsense.
2019-07-05 09:42:07 +01:00
David Chisnall
c2780f99ed [FreeBSD] Fix a warning with GCC. 2019-07-01 14:35:35 +01:00
Matthew Parkinson
b38c36b40f Added a fflush to the error message. 2019-05-08 17:56:48 +01:00
Matthew Parkinson
3c9fe1041a Added error message to Windows Pal using VirtualAlloc. (#44) 2019-05-08 17:10:53 +01:00
Matthew Parkinson
8fcedfc290 Fix the GCC build (#40)
* Make it compile with GCC.  
* Add GCC to CI.
* Add warning to documentation about using GCC.
2019-05-05 19:58:37 +01:00
David Chisnall
d978b7a68f Apply clang-tidy checks to the Linux build. 2019-04-30 15:06:45 +01:00
David Chisnall
95c23b1a00 Add the const parameter checker.
This complains if a non-const parameter is not modified. In the PALs,
the size parameter is modified only by some implementations, so we can
make it const in the ones where it isn't.
2019-04-30 09:46:10 +01:00
David Chisnall
5c197e4ae4 [NFC] More checks, comments on end of namespace braces. 2019-04-30 09:46:01 +01:00
David Chisnall
22d33ebf99 Add another checker.
Use nullptr where appropriate.
2019-04-29 15:00:25 +01:00
Matthew Parkinson
f1a26db8e5 Missing externs 2019-04-29 11:02:47 +01:00
Matthew Parkinson
37afe9d079 Clang format 2019-04-29 11:02:47 +01:00
Matthew Parkinson
4faf9f3bee Use fewer header files
Removing some includes to reduce the code that is dragged in.
2019-04-29 11:02:47 +01:00
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