Matthew Parkinson
fdcad7feb4
Add test for sizeclass calculations
2019-02-11 14:47:12 +00:00
David Chisnall
ccd8ec9b4f
Disable rtti / exceptions on the non-Windows builds.
...
RTTI makes the binaries bigger, exceptions make life harder for
optimisers. Neither are actually used.
This doesn't preclude anything #including snmalloc.h with RTTI enabled,
it just disables it in the shim libraries and tests.
The FreeBSD libc builds were already doing this with no ill effect.
2019-02-06 17:46:58 +00:00
Matthew Parkinson
2cd84c80b2
Build shim with 1MiB superslabs.
2019-02-06 17:08:47 +00:00
Matthew Parkinson
731757b29c
Merge pull request #13 from Microsoft/matt-refactor
...
Simplification around remote allocation
2019-02-06 11:25:07 +00:00
Matthew Parkinson
f3897dd3e0
Code review feedback.
2019-02-05 16:57:09 +00:00
Matthew Parkinson
83c55fe5da
Simplify remote allocator.
...
Don't store the sizeclass, as we can find it easily, and already are
going to touch though cache lines in the common case.
2019-02-05 13:27:19 +00:00
Matthew Parkinson
122a5de811
Refactor code to correctly handle low bits of allocator ID.
2019-02-05 13:11:55 +00:00
David Chisnall
fc24b8be3d
Merge pull request #12 from Theodus/override
...
Avoid unnecessary allocation from realloc
2019-02-03 13:30:21 +00:00
theodus
ae3f9f6aec
Get alloc size without wrapper
2019-02-03 08:19:11 -05:00
theodus
2b8b4c884f
Do not realloc if size is in the same sizeclass
2019-02-02 17:28:02 -05:00
theodus
85cf5dd097
Avoid unnecessary allocation from realloc
2019-02-02 14:47:06 -05:00
Matthew Parkinson
c0ceb6e08f
Merge pull request #11 from Theodus/master
...
Fix assertion failure in memalign
2019-01-30 17:36:13 +00:00
theodus
61b310d9d6
Fix assertion failure in memalign
2019-01-30 12:14:16 -05:00
Matthew Parkinson
a838372989
Merge pull request #10 from Microsoft/hardening
...
Hardening allocator
2019-01-25 23:16:30 +00:00
Matthew Parkinson
ec59820970
Use placement new instead of init for metaslab.
2019-01-25 19:46:24 +00:00
Matthew Parkinson
06ff1ffe0a
Renamed zero to init for metaslab.
2019-01-25 16:38:10 +00:00
Matthew Parkinson
e5c40c1231
Remove an auto as not correctly inferred.
2019-01-24 11:48:02 +00:00
Matthew Parkinson
d5fb7150a3
Clang format
2019-01-24 11:39:19 +00:00
Matthew Parkinson
294efe8e03
Hardening access to meta data
...
Introduce a wrapper that ensure various fields of meta data, represent
valid indexes into the the address space, and not beyond the current
slab/superslab.
2019-01-24 11:39:18 +00:00
Matthew Parkinson
2083b29c9b
Remove a raw pointer usage
...
Metaslab can be handled as as ref, rather than a raw pointer.
2019-01-24 11:39:18 +00:00
Matthew Parkinson
e30c94cb2a
Apply ModArray to Metaslab data
...
Prevent bugs accessing outside the Slabs meta data.
2019-01-24 11:39:18 +00:00
Matthew Parkinson
5b81caac87
Merge pull request #9 from Microsoft/two_alloc_types
...
Add example for including the allocator with different settings in two compilation units.
2019-01-24 11:38:20 +00:00
Matthew Parkinson
67fbcba653
Clang format
2019-01-24 11:22:44 +00:00
Matthew Parkinson
28a28bb1ed
Simple example of using two allocators in one application.
...
Example to simulate using two allocators in one application. This will
be useful for scenarios in openenclave.
2019-01-23 13:19:46 +00:00
Matthew Parkinson
5240b3f8c6
Formatting
2019-01-23 11:06:07 +00:00
Matthew Parkinson
ef3a578503
Allow __je_bootstrap methods to not be compiled
...
The __je_bootstrap.. allocator methods can be specified that they
shouldn't be compiled using NO_BOOTSTRAP_ALLOCATION.
2019-01-23 11:05:50 +00:00
Matthew Parkinson
8d074468ae
Fix MSVC warning in malloc.cc
2019-01-23 11:03:43 +00:00
Matthew Parkinson
e51f1c3d50
Namespace test globals for external_pointer
...
Some times the global count was leading to a warning with a local count
in the test.
2019-01-23 11:03:13 +00:00
Matthew Parkinson
e0a2f10412
Merge pull request #8 from Microsoft/external_pointer_fix
...
External pointer fix
2019-01-22 17:53:59 +00:00
Matthew Parkinson
745a2a53d1
Clang format
2019-01-22 17:18:54 +00:00
Matthew Parkinson
cb70aa3f7f
Restricted another array to bounds.
2019-01-22 11:19:57 +00:00
Matthew Parkinson
1d5df3b7a9
Build both 1MiB and 16MiB tests
2019-01-22 11:19:57 +00:00
Matthew Parkinson
18dd15c2c0
Minor restructuring to move static_assert
2019-01-22 11:19:57 +00:00
Matthew Parkinson
bb5027b454
Harden sizeclass table
...
If a sizeclass in the metadata is corrupted, then this can be used to
force an index beyond the end of these tables. This extends the tables
to the next power of two, and uses a mask on the index, so they are
always either a valid piece of data, or zero.
2019-01-22 11:19:57 +00:00
Matthew Parkinson
94f8b886a0
Remove union in metaslab
...
The union in Metaslab provides no benefit in size, as the single byte
it effectively saves will be removed due to padding.
By removing the union, we get stronger properties over sizeclass, and
remove an out-of-bounds access.
2019-01-18 21:11:01 +00:00
Matthew Parkinson
dc19b5ace2
Test to check external pointer on deallocated objects
...
This fails an assertion as it reads from a "head" and assumes it is a
sizeclass. This leads to accessing memory out of bounds.
2019-01-18 21:11:01 +00:00
David Chisnall
20b84b9810
Merge pull request #7 from Microsoft/mjp41/refactor
...
Fixes remote and pagemap
2019-01-18 17:11:25 +00:00
Matthew Parkinson
c1e23c497f
Made alignment a template parameter.
2019-01-18 17:00:10 +00: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
a62e77f930
Align pagemap entries to OS_PAGE_SIZE
...
Guarantee the page map is page aligned. Fix public API.
2019-01-18 15:22:08 +00:00
Matthew Parkinson
62ad70b17e
Fixes to remote deallocation
...
The encoding in the top bits for the size class did not respect kernel
pointers. Using an intptr_t means, we can use a signed shift to
maintain the kernel pointers.
2019-01-18 14:30:23 +00:00
Matthew Parkinson
9e53412bb9
Merge pull request #6 from Microsoft/mjp41/refactor
...
Rename TypeAlloc to Pool
2019-01-18 12:34:02 +00:00
Matthew Parkinson
806f7e47cc
Rename TypeAlloc to Pool
...
Minor refactor to clarify purpose of the pool.
2019-01-18 11:12:09 +00:00
Matthew Parkinson
5076bf6f32
Merge pull request #5 from Microsoft/AddressSpace
...
Address space constrained option
2019-01-17 18:43:40 +00:00
Matthew Parkinson
4748f25e57
Removing warnings from Windows Ninja configuration
...
Windows Ninja build was complaining about /W4 and /W3 being
specified, and C++ latest and C++ 17. This fixs those complaints.
2019-01-17 18:23:06 +00:00
Matthew Parkinson
e9ab9e8e24
Typo
2019-01-17 18:18:18 +00:00
Matthew Parkinson
4ad12f33cf
Fix spacing from a bad clang format.
2019-01-17 16:47:55 +00:00
Matthew Parkinson
0b57ff3667
Code Tidy
...
Remove explicit constructor as it is implicit.
2019-01-17 14:38:47 +00:00