Matthew Parkinson
9f53ec0ef8
Reduce dependence on C++ runtime
...
If the external thread statics are used, then
we don't need to include some C++ runtime
concepts. This refactoring moves some global initialization under
conditional compilation.
2020-02-26 17:55:29 +00:00
Matthew Parkinson
3775a625a4
Fix systematic testing for Verona.
2020-02-10 12:12:51 +00:00
Matthew Parkinson
28658a47f0
Code review feedback.
2020-02-05 12:47:24 +00:00
Matthew Parkinson
bad94e80d3
Clangformat
2020-02-04 10:24:57 +00:00
Matthew Parkinson
4b175fceeb
Make Posix platforms check Commit in Debug
...
By turning page access on and off, we can simulate the Windows
Commit/Decommit states on Posix platforms.
This is just enabled in Debug for now.
2020-02-04 10:19:23 +00:00
Matthew Parkinson
4fea7b8bb1
Make Pals only return amount of memory requested
...
The PAL API previously allowed for returning more memory than asked for.
This was when the PAL performed the alignment work, now this is done in
large alloc, so removing from the PAL.
2020-02-04 10:19:22 +00:00
Matthew Parkinson
0affc069cf
Make snmalloc build on Windows with Clang
...
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.
2020-01-26 19:46:18 +00:00
Nathaniel Filardo
4d6759aca4
Make "pal_supports" not a function
...
But rather a template vardecl, as per C++14
2019-12-04 16:54:41 +00:00
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