David Chisnall
c47eed1922
Tweaks to end bounds checking.
...
Introduce a `OnePastEnd` option for the pointer immediately after the
end of the allocation. This simplifies some of the logic in callers,
where they wants to say 'is base + length safe to use?'.
Also restructure some of the other logic somewhat.
2019-02-15 20:05:00 +01:00
Theo Butler
9a6b0aef1f
Merge pull request #23 from Microsoft/comment
...
Fix comment to represent current PAL API.
2019-02-15 13:42:59 -05:00
Matthew Parkinson
5e149b083f
One more constexpr
2019-02-15 17:43:27 +00:00
Matthew Parkinson
8698f87018
Added some constexpr to some ifs.
2019-02-15 16:12:38 +00:00
Matthew Parkinson
c02077a06a
Bug fix in umul code for 32-bit Win
2019-02-15 14:36:47 +00:00
Matthew Parkinson
e7d90966f6
Made the malloc tests run on Windows
2019-02-15 14:36:47 +00:00
Matthew Parkinson
ac8e5e4e5b
Fix comment to represent current PAL API.
2019-02-15 09:24:01 +00:00
Theo Butler
a3fb2b9531
cleanup some tests
2019-02-14 22:31:45 -05:00
Theo Butler
d2909eed0a
Merge branch 'master' into malloc-tests
2019-02-14 22:30:48 -05:00
Matthew Parkinson
adeecfb0f1
Added bug fix to alignment of using.
2019-02-14 20:08:04 +00:00
Matthew Parkinson
8b9a525500
Added zero test at threshold.
2019-02-14 19:59:36 +00:00
Theo Butler
c555bf7218
fix doc comments for notify_using
2019-02-13 17:15:06 -05:00
Theo Butler
057595a57e
remove -1 check in calloc
2019-02-13 16:03:38 -05:00
Theo Butler
942313fec7
replace asserts with abort
2019-02-13 10:03:41 -05:00
Theo Butler
24ba068dce
remove randomness from malloc tests
2019-02-13 08:42:51 -05:00
theodus
a9615bc6aa
mark variables unused in release build
2019-02-12 20:22:10 -05:00
Theo Butler
f6497e6ee3
Add malloc tests
2019-02-12 19:50:15 -05:00
Paul Liétar
79b432ddab
Fix the condition on when to allocate a new block.
...
Previously we would pretty much always allocate a new block for each
allocator, making them 16MiB aligned.
2019-02-12 12:47:22 +00:00
Matthew Parkinson
e004641cec
Added to comment.
2019-02-11 14:47:12 +00:00
Matthew Parkinson
9981bad9b5
clang format
2019-02-11 14:47:12 +00:00
Matthew Parkinson
1272078487
Simplified size class calculation
...
The rounding code can be integrated directly into the sizeclass code,
which means, the code paths can be simplified slightly.
The special case for zero mantissa bits is not required, as the compiler
generates the same code from the more complex path due to
eliminating dead code after folding the constant zero through.
2019-02-11 14:47:12 +00:00
Matthew Parkinson
fdcad7feb4
Add test for sizeclass calculations
2019-02-11 14:47:12 +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
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
theodus
61b310d9d6
Fix assertion failure in memalign
2019-01-30 12:14:16 -05: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
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
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
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