Граф коммитов

1196 Коммитов

Автор SHA1 Сообщение Дата
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
Matthew Parkinson ee9d899aa3 Remove GRANULARITY check
This check was not doing anything.  It was from an earlier dependency
ordering issue that has now been fixed.
2019-01-17 14:38:14 +00:00
Matthew Parkinson 164df40372 Add configuration option for small address spaces
This adds a configuration option for 1MiB superslabs with 16KiB slabs.
2019-01-17 14:09:50 +00:00
Matthew Parkinson b097b47aa2 Handle 2^16 slabs
This code assumes that 16bit uint wrapping can be used, rather than
masking by SLAB_SIZE-1.  Add explicit mask, so we can change the
SLAB_SIZE to be smaller.
2019-01-17 14:09:50 +00:00
David Chisnall e81dacc1c5 FreeBSD libc allocator fixes.
Provide a hook so that the exported malloc symbols can be weak.  This is
mostly needed so that rtld, which statically links libc.a, can override
the symbols.

Add a bootstrap allocator so that statically linked binaries can have
their TLS space allocated before malloc is called and uses TLS.
2019-01-17 10:20:14 +00:00
Matthew Parkinson cf8699df4f
Update README.md
Added a build badge
2019-01-16 17:19:22 +00:00
David Chisnall 1324279eb5 Added some missing #includes. 2019-01-16 17:17:51 +00:00
Matthew Parkinson dca05e2556
Merge pull request #3 from Microsoft/ThirtyTwoBit
Windows 32bit build
2019-01-16 17:12:03 +00:00
Matthew Parkinson ab57c86e3a Addressing CR feedback 2019-01-16 17:03:15 +00:00
Matthew Parkinson c4e6af4bad Remove spaces from CI task names 2019-01-16 15:22:29 +00:00
Matthew Parkinson 8a0e20eae3 Added 32bit Windows compile to the CI 2019-01-16 15:17:38 +00:00
Matthew Parkinson 233be30731 Implement a FlatPagemap
The current pagemap assumes there is at least one level of indexing.
This commit introduces a new pagemap that is completely flat.  This is
useful for 32bit, where there is no need to introduce the indexing
structure.

This pagemap is also considerably faster for 64bit platforms, but
does require a global allocation of 16MiB of the flat page map.
2019-01-16 14:38:11 +00:00
Matthew Parkinson 82595dc9cd Made Remote deallocation work on 32bit
The design of Remote used the top bits of the allocator id to encode
the sizeclass of the deallocation.  On 32bit, or on a platform that uses all the bits
we cannot use these bits for a sizeclass.

This commit uses the bottom bit of the allocator id (which is
guaranteed to be 0), to indicate if the object is the minimum
allocation size.  If it is not the minimum allocation size the
subsequent byte is used to encode the sizeclass.

The code uses constexpr to decide which strategy to use.
2019-01-16 14:38:10 +00:00
Matthew Parkinson 272bebb927 Reduce size of test on 32bit 2019-01-16 14:38:10 +00:00
Matthew Parkinson 74018a1c91 Correct PageMap public API 2019-01-16 14:38:10 +00:00
theodus e2190f376f Fix typo in threadalloc.h 2019-01-16 09:22:01 +00:00
Matthew Parkinson 2d9ca1eb52
Merge pull request #1 from Microsoft/azure-pipelines
Set up CI with Azure Pipelines
2019-01-15 14:48:39 +00:00
Matthew Parkinson 5d71f3bf85 Migrated original CI script. 2019-01-15 14:26:50 +00:00
Matthew Parkinson 4a7909f22b Set up CI with Azure Pipelines 2019-01-15 14:23:45 +00:00
Matthew Parkinson 4f9d991449 Initial commit of snmalloc
History squashed from internal development.

Internal history has commit hash:
  e27a0e485c44a5003a802de2661ce3b21e120316
2019-01-15 14:17:55 +00:00
Microsoft Open Source e488c24784 Initial commit 2019-01-09 06:05:58 -08:00
Microsoft Open Source 5d3628d31c Initial commit 2019-01-09 06:05:57 -08:00
Microsoft GitHub User 6249f7e230
Initial commit 2019-01-09 06:05:54 -08:00