Commit Graph

219 Commits

Author SHA1 Message Date
Theo Butler
f9b9523d0c add ld preload build to linux matrix 2019-05-18 11:07:50 +02:00
Theo Butler
f5000c087f merge clang and gcc build into one matrix 2019-05-18 10:38:41 +02:00
Matthew Parkinson
bcfc60f3e6 Merge pull request #48 from ashamis/add_to_readme
Add instructions on how to use the header-only library
2019-05-17 16:03:10 +01:00
Alex Shamis
e326d84e05 Add instructions on how to use the read-only library 2019-05-17 13:39:03 +01:00
Matthew Parkinson
a2dea6cf1d Merge pull request #55 from Theodus/ci
Install g++7 for Linux-gcc CI
2019-05-16 21:35:00 +01:00
Theo Butler
54f219c902 Install g++7 for Linux-gcc CI 2019-05-16 20:35:04 +02:00
Matthew Parkinson
6be7e0d842 Merge pull request #54 from microsoft/stats_atexit
Made the statistics print atexit
2019-05-16 14:51:30 +01:00
Matthew Parkinson
b8bcfc0798 Made the statistics print atexit
Fixed some statistics and made them automatically print atexit.
2019-05-16 11:43:44 +01:00
Matthew Parkinson
48416e3241 CR Feedback 2019-05-14 21:16:11 +01:00
Matthew Parkinson
b484619f20 Added branch predictor hint. 2019-05-14 21:16:11 +01:00
Matthew Parkinson
5d711a2e65 Made checking debug only 2019-05-14 21:16:11 +01:00
Matthew Parkinson
e5d617c5fb Improve TLS performance
Refactor fast and slow paths to improve inlining
and codegen.
2019-05-14 21:16:11 +01:00
Matthew Parkinson
3c7582f717 Remove two unused functions. 2019-05-10 15:12:26 +01:00
Matthew Parkinson
1e4eb3dea3 CMake Header-Only Target (#46)
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.
2019-05-09 12:32:32 +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
8d5432c559 Expensive test property. (#43)
Make expensive tests run sequentially to prevent possible out-of-memory issues.
2019-05-08 15:51:41 +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
0b64536be4 Merge pull request #39 from Microsoft/clang-tidy-ci
Add clang-tidy to CI.
2019-04-30 10:22:13 -04:00
David Chisnall
d978b7a68f Apply clang-tidy checks to the Linux build. 2019-04-30 15:06:45 +01:00
David Chisnall
d259a87d03 Make clang-tidy fail when it ought to.
clang-tidy exits with an error code of 0 if the code compiles, even if
there are warnings.  Make it generate a file with the errors and fail
the test if this file exists.

Also remove the -fix flag - we don't want clang-tidy to fix things in CI
(yet?).
2019-04-30 15:02:55 +01:00
David Chisnall
4f8c7ba258 Add clang-tidy to CI. 2019-04-30 14:52:19 +01:00
David Chisnall
747063db87 Merge pull request #38 from Microsoft/clang-tidy
Clang tidy
2019-04-30 09:41:12 -04:00
David Chisnall
8f082c6a9c Fix incorrect edit in earlier commit. 2019-04-30 14:11:15 +01:00
David Chisnall
840e00b430 Fix sign warning. 2019-04-30 14:08:41 +01:00
David Chisnall
8bd136c224 Remove all instances of static_cast<size_t>(1).
In preparation for removing magic numbers, simplify code that is
computing masks with a single bit set.
2019-04-30 11:50:32 +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
91f2310215 More checks.
Use using instead of typedef.
2019-04-30 09:46:01 +01:00
David Chisnall
5c197e4ae4 [NFC] More checks, comments on end of namespace braces. 2019-04-30 09:46:01 +01:00
David Chisnall
49ece8f4e1 Enable the static analyser from clang-tidy.
Fix a false positive.  The loops in the pagemap accessor are too
complicated for the static analyser to check, so it doesn't spot that a
non-null return is impossible.
2019-04-30 09:46:01 +01:00
David Chisnall
d06e539732 Add more checks.
Add missing parentheses in UNUSED (shouldn't matter, but keeps a checker
that may catch real bugs elsewhere happy).
2019-04-30 09:46:01 +01:00
David Chisnall
c2679188ad Fix the build on Windows. 2019-04-30 09:38:35 +01:00
David Chisnall
b5bc09ced3 Add some more checkers.
Change the result of `operator=` on `Mod` to return `Mod&`.  In this
example:

```c++
Mod<4, int> a;
int b = (a = 8);
```

The value of `b` will now be 0, not 8, and will equal the value of `a`.
Hopefully this is less confusing to users of this class.
2019-04-29 15:14:43 +01:00
David Chisnall
22d33ebf99 Add another checker.
Use nullptr where appropriate.
2019-04-29 15:00:25 +01:00
David Chisnall
c3c71afa57 Move pagemap to using InvalidPointer.
Replace a constant `uintptr_t` value of 1 that was repeatedly cast to a
pointer with an `InvalidPointer<1>`.
2019-04-29 13:46:57 +01:00
David Chisnall
28fac4d700 Fix the remaining clang-tidy warnings.
This introduces a new `address_t` type and two new casts: `pointer_cast`
and `address_cast` for casting between an `address_t` and a pointer.
These should make it easier to audit the codebase for casts between
pointers and integers.  In particular, the remaining `reinterpret_cast`s
and `pointer_cast`s should be the only places where we could perform
invalid pointer arithmetic.

Also adds a `pointer_offset` helper that adds an offset (in bytes) to a
pointer, preserving its original type.  This is a sufficiently common
pattern that it seemed worthwhile to centralise it.
2019-04-29 13:37:05 +01:00
Matthew Parkinson
09c884b553 Merge pull request #37 from Microsoft/invalid_pointer
Add an explicit invalid pointer type.
2019-04-29 11:35:11 +01:00
David Chisnall
4bafca9be7 [NFC] Automatic fixes from clang-tidy. 2019-04-29 11:33:07 +01:00
David Chisnall
e6325e5cd2 Add a clang-tidy config file.
Small set of checks for now, we can add to this over time.
2019-04-29 11:30:23 +01:00
David Chisnall
365571b2b8 Add an explicit invalid pointer type.
This is a generalisation of `std::nullptr_t` that allows non-0 values of
pointer-sized-but-not-a-pointer thing.  `DLList` now takes an
`InvalidPointer`, `nullptr_t`, or some other compatible class as a
sentinel value instead of a `uintptr_t`.
2019-04-29 11:22:40 +01:00
Matthew Parkinson
4a0299ec77 Clang format 2019-04-29 11:02:47 +01:00
Matthew Parkinson
f1835813bd uintptr_max instead of -1/~0 2019-04-29 11:02:47 +01:00
Matthew Parkinson
c471e1a271 CR 2019-04-29 11:02:47 +01:00
Matthew Parkinson
8eb6e36966 Add comment about min/max. 2019-04-29 11:02:47 +01:00
Matthew Parkinson
70e2fcf26f Fix 32bit build 2019-04-29 11:02:47 +01:00
Matthew Parkinson
5030fff9bd Missing include from test. 2019-04-29 11:02:47 +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
f88bcdbf58 Made alloc_chunk typed
Alloc_chunk now allocates and calls the constructor.
2019-04-29 11:02:47 +01:00
Matthew Parkinson
2d831920ea Factored casting in external pointer calculation 2019-04-29 11:02:47 +01:00