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

975 Коммитов

Автор SHA1 Сообщение Дата
Emanuel Hoogeveen 02d10f1bfa Bug 1405159 - Assert against freeing incorrectly offset pointers. r=glandium 2017-10-02 15:39:00 -04:00
Nicholas Nethercote a6fede36c2 Bug 1384814 - Remove critical address machinery from Mac implementation of MozStackWalk(). r=glandium.
It seemingly hasn't been needed since Mac OS 10.7. A diagnostic assertion that
has been in place for a while hasn't caught any uses of it.

--HG--
extra : rebase_source : 9834849eec9174267c7df8de7fd22840ffa36d8f
2017-10-03 13:53:14 +11:00
Jan Keromnes 30acb879f3 Bug 1403660 - Do not use 'else' after 'break' in /memory/build/rb.h. r=njn 2017-09-28 08:01:00 -04:00
Mike Hommey fd18ca4367 Bug 1403843 - Disable static sizes on debug builds. r=njn
Because why not, especially now that this only concerns the page size.

--HG--
extra : rebase_source : 9ff92d2551e0bb8633072e0c8d5aa36c570314e1
2017-09-28 15:15:23 +09:00
Mike Hommey 450b12cd79 Bug 1403843 - Make quantum, small and chunk sizes always static. r=njn
Bug 571209 made many different kinds of sizes static at build time, as
opposed to configurable at run-time. While the dynamic sizes can be
useful to quickly test tweaks to e.g. quantum sizes, a
replace-malloc-built allocator could just as well do the same. This
need, however, is very rare, and doesn't justify keeping the sizes
dynamic on platforms where static sizes can't be used for the page size
because page size may vary depending on kernel options.

So we make every size that doesn't depend on the page size static,
whether MALLOC_STATIC_SIZES is enabled or not.

This makes no practical difference on tier-1 platforms, except Android
aarch64, which will benefit from more static sizes.

--HG--
extra : rebase_source : 28243a67e4fe41154c23dc39b45405479854d31d
2017-09-28 15:27:59 +09:00
Mike Hommey 2e77077792 Bug 1403821 - Don't force the allocator to be always compiled with optimizations. r=froydnj
This was done in bug 1104634 because back then the Android NDK had a
broken combination of compiler and libc, where the compiler would emit
calls to the ffs function, but the libc wouldn't contain them, but only
when building without optimization.

Things have changed in the meanwhile, and recent NDK doesn't have this
problem. So we can remove the hack.

--HG--
extra : rebase_source : 22d6c279a60d0d23161ca1addd5b5e9a3411d8ab
2017-09-28 11:27:43 +09:00
Mike Hommey 7ee99ec56b Bug 1403824 - Keep track of arenas in the arena tree. r=njn
Bug 1402174 made all arenas registered in a Red-Black tree. Which means
they are iterable through that tree, making the arenas list now redundant.
The list is also inconvenient, since it needs to be constantly
reallocated, and the allocator in charge of the list doesn't know how to
free things.

Iteration of arenas is not on any hot path anyways, so even though
iterating the RB tree is slower, it doesn't matter.

So we remove the arenas list, and keep a direct pointer to the main
arena for convenience (instead of calling First() on the RB tree every
time)

--HG--
extra : rebase_source : 31f12b2de18a886eb4f8f078e11040aad3fdc800
2017-09-28 08:06:23 +09:00
Mike Hommey 3e25c152cf Bug 1403766 - Always use some sort of thread local storage in the allocator. r=njn
As we're going to enable stylo on Android at some point, we'll have to
have thread local arenas there, which means Android needs to be using
thread local storage. Since Android is the last use of NO_TLS in the
allocator code base, remove it.

--HG--
extra : rebase_source : 658cbc94b4478950f683bd104b7e5da27cd08a2e
2017-09-28 08:28:52 +09:00
Mike Hommey 4877b48a43 Bug 1403765 - Use native TLS in the allocator on Windows. r=njn
--HG--
extra : rebase_source : d6f46f9f4a09079f62f44b6aed6dd4bd8d60530c
2017-09-25 06:47:44 +09:00
Mike Hommey d8428609d8 Bug 1403444 - Remove typedefs for RedBlackTrees. r=njn
--HG--
extra : rebase_source : 0cc425c0e941108a4387ac594f6f258c68a35f4e
2017-09-28 06:58:37 +09:00
Mike Hommey 33d3d2113b Bug 1403444 - Rename the RedBlackTree member variables. r=njn
--HG--
extra : rebase_source : 5bfc9d0711af7acfbe3f8a6711e82f103ae13ece
2017-09-27 16:11:11 +09:00
Mike Hommey f0908215f5 Bug 1403444 - Add a helper class to avoid the tree traversal code having to use Trait::GetTreeNode noisily. r=njn
--HG--
extra : rebase_source : b73d82b3529e4910d890cb9dfb08cacdff5b7a64
2017-09-27 16:07:22 +09:00
Mike Hommey 8c16cb5da2 Bug 1403444 - Replace the rb_foreach_* macros with a range iterator. r=njn
--HG--
extra : rebase_source : 6a487f1f660ec15cea8b91e89fc473b8cc17a669
2017-09-27 15:25:19 +09:00
Mike Hommey cb629a1000 Bug 1403444 - Remove rbp_f_synced. r=njn
Bug 1365460 removed the macros that used it.

--HG--
extra : rebase_source : 6f732916e3cdbf2b1dfd8e929fb9424a1e41352a
2017-09-27 13:50:50 +09:00
Mike Hommey 8f6d19c631 Bug 1403444 - Replace rbp_move_red_left and rbp_move_red_right with private methods. r=njn
--HG--
extra : rebase_source : e93e7256d3c94fc4aad9469fa00cd65f68c0a5e4
2017-09-26 21:21:13 +09:00
Mike Hommey d5840a27d6 Bug 1403444 - Replace rbp_lean_left and rbp_lean_right with private methods. r=njn
--HG--
extra : rebase_source : 08fd0203f37706563a3c584225bb1790a1bd57b9
2017-09-26 21:14:12 +09:00
Mike Hommey 0938630279 Bug 1403444 - Replace rbp_rotate_left and rbp_rotate_right with private methods. r=njn
--HG--
extra : rebase_source : 1f576d36ae451d03a96b2a7285912c2a2fb4d1e5
2017-09-26 21:08:29 +09:00
Mike Hommey fb8f789c51 Bug 1403444 - Expand rb_remove. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : 05be3b680645da9665449e5417efdf862d7e5f96
2017-09-26 17:13:53 +09:00
Mike Hommey 8d2fab69cf Bug 1403444 - Expand rb_insert. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : 610d774220fd2dbe40872f16e86eca57c11b31c3
2017-09-26 17:07:35 +09:00
Mike Hommey dcd990824b Bug 1403444 - Expand rbp_first and rbp_last. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : a61d3eb96da054a50bc016dc6a4969f42adf9dfa
2017-09-26 16:59:02 +09:00
Mike Hommey 3c5e2cba4f Bug 1403444 - Allow First and Last to take a start node, and use that in Next and Prev. r=njn
--HG--
extra : rebase_source : a2d00f91ad98e7bd1478624a0a9b374de52f543b
2017-09-26 16:55:31 +09:00
Mike Hommey d4ac54ef7d Bug 1403444 - Expand rb_search and rb_nsearch. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : d68bce212b04b927e32d360b0d606692a336598a
2017-09-26 16:46:43 +09:00
Mike Hommey 28b7741df7 Bug 1403444 - Expand rbp_next and rbp_prev. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : 6f6344a703c7cf56ddf97efabbd05d47f389266a
2017-09-26 16:39:03 +09:00
Mike Hommey bc635f3082 Bug 1403444 - Trivially expand rb_node_field. r=njn
Also replace `a_field((foo))` with `a_field(foo)` in the resulting code.

--HG--
extra : rebase_source : acc6c43320e9ee932e878c13cc2d6766a158cdba
2017-09-26 16:36:24 +09:00
Mike Hommey b3937aa599 Bug 1403444 - Expand rbp_node_new. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : a903717427dbb8b2cd05ec462b821131d0000ea2
2017-09-26 16:00:27 +09:00
Mike Hommey 6561941f93 Bug 1403444 - Expand rb_new, rb_first, rb_last, rb_next and rb_prev. r=njn
At the same time, simplify the expanded code to better fit in the
template.

--HG--
extra : rebase_source : fa002197c5f4801ae7cf8b704b023393fc4cc6b5
2017-09-26 15:47:50 +09:00
Mike Hommey 8392daa18e Bug 1403444 - Add methods to the RedBlackTree template class, replacing rb_wrap. r=njn
--HG--
extra : rebase_source : e0f71386b0097034b5e6c629113dff38e574ea74
2017-09-26 15:06:00 +09:00
Mike Hommey 4ec0ed7879 Bug 1403444 - Move miscellaneous size related constants and macros earlier in mozjemalloc.cpp. r=njn
--HG--
extra : rebase_source : e277943abe1aa664bb7c24388f425fac0dc170aa
2017-09-26 09:08:00 +09:00
Mike Hommey 81cb21567f Bug 1403444 - Replace some uses of IsRed() with Color() or IsBlack(). r=njn
The trivial expansion of macros ended up creating cases like
  expr.IsRed() ? NodeColor::Red : NodeColor::Black
which practically speaking, is the same as
  expr.Color()
so we replace those.

There are also a bunch of expr.IsRed() == false, which are replaced with
expr.IsBlack() (adding that method at the same time)

--HG--
extra : rebase_source : ab50212ff80f0c0151e7df329d8933ccd45f9781
2017-09-27 08:54:49 +09:00
Mike Hommey 3787074984 Bug 1403444 - Trivially expand rbp_{color,red,black}_set. r=njn
--HG--
extra : rebase_source : ebef4dedd44ce3bf181ba840a33e975ae2f423c3
2017-09-25 10:03:56 +09:00
Mike Hommey d0d3055917 Bug 1403444 - Trivially expand rbp_right_set. r=njn
--HG--
extra : rebase_source : f3824bc5e3992e78671418a0f65daf3bffce2d56
2017-09-25 10:05:07 +09:00
Mike Hommey a9819bb805 Bug 1403444 - Trivially expand rbp_left_set. r=njn
--HG--
extra : rebase_source : 1fc855c907ddeb1dd21473003cae8f9b32e23336
2017-09-25 10:04:32 +09:00
Mike Hommey 7776a84304 Bug 1403444 - Trivially expand rbp_red_get. r=njn
--HG--
extra : rebase_source : dae723877cb4fc04cd085a7b9a441a2df38e68c9
2017-09-25 10:02:48 +09:00
Mike Hommey d3ada6727c Bug 1403444 - Trivially expand rbp_right_get. r=njn
--HG--
extra : rebase_source : f5ee449b8683266aa2143d53b3316f782c5d5ac7
2017-09-25 10:02:22 +09:00
Mike Hommey d871a7f54e Bug 1403444 - Trivially expand rbp_left_get. r=njn
--HG--
extra : rebase_source : 99cb24df5ce2377ac24194e5bf79b23dd08269f0
2017-09-25 10:02:06 +09:00
Mike Hommey 2a81acdfab Bug 1403444 - Abstract red-black-tree link field reference with a new macro. r=njn
While we're going in the opposite direction, moving away from macros,
upcoming intermediate steps are going to "manually" expand macros, but
later steps will require changing how the link field reference is done,
and having it in a single location then will be more convenient.

--HG--
extra : rebase_source : 6dde414ce392924081a41b7e3f66ae848cb14be5
2017-09-25 07:03:37 +09:00
Mike Hommey 4b17f4882c Bug 1403444 - Apply clang-format to the rb.h macros. r=njn
--HG--
extra : rebase_source : d1a55373811fea242c5b91666ba545532e6bbdde
2017-09-25 06:59:30 +09:00
Mike Hommey f43e83a278 Bug 1403444 - Use a fixed size for the stack space used during rb_foreach. r=njn
That stack space would matter if recursion was involved, but there
isn't any, and a max of 1440 bytes temporarily allocated on the stack
is not really a problem.

--HG--
extra : rebase_source : 2968fafe9d604d9e6c03ac93c21d8a3a087043a4
2017-09-25 06:57:09 +09:00
Mike Hommey bba7d810d3 Bug 1403444 - Make the "static" part of what the rb_wrap macro expands to.. r=njn
All uses of rb_wrap have "static" as first argument to rb_wrap, move that
in the macro itself.

--HG--
extra : rebase_source : cbfe87d0539452c044b415c725cb7ce6ebb5628c
2017-09-03 06:49:39 +09:00
Mike Hommey b8a3c5fa7f Bug 1403444 - Add getters and setters on RedBlackTreeNode. r=njn
--HG--
extra : rebase_source : db31bf584071164346463cd54ca359547fcd0eb6
2017-09-02 20:26:09 +09:00
Mike Hommey 02f0da2a19 Bug 1403444 - Use templates for rb_node and rb_tree, and rename them. r=njn
--HG--
extra : rebase_source : ab470e80a786d290f0df61f4adf2c128f9ecb925
2017-09-02 09:05:13 +09:00
Mike Hommey 77ff4db6d7 Bug 1402647 - Add a memalign implementation on platforms that don't have one. r=njn
--HG--
extra : rebase_source : bf1ff9da4c4647f5e930194d0d008466f0b2b593
2017-09-26 06:59:03 +09:00
Mike Hommey d7703e388f Bug 1402647 - Add missing stdlib.h header for system allocator. r=njn
--HG--
extra : rebase_source : caa72506b79e02f953911ab859244d9f9909f389
2017-09-26 06:58:05 +09:00
Mike Hommey 633a0d02d9 Bug 1402174 - Initial actual implementation of the moz_arena_* API. r=njn
Things left for followups:
- Full cleanup of disposed arenas: bug 1364359.
- Random arena Ids: bug 1402282.
- Enforcing the arena to match on moz_arena_{realloc,free}: bug 1402283.
- Make it impossible to use arenas not created with moz_create_arena
  with moz_arena_* functions: bug 1402284.

Until it's proven to require a different data structure, arena lookup by
Id is done through the use of the same RB tree used everywhere else in
the allocator.

At this stage, the implementation of the API doesn't ride the trains,
but the API can be used safely and will fall back to normal allocations
transparently for the caller.

--HG--
extra : rebase_source : aaa9bdab5b4e0c534da0c9c7a299028fc8d66dc8
2017-09-21 14:24:37 +09:00
Mike Hommey 3efd8d6f3a Bug 1402174 - Add a helper class implementing the base allocator functions for a given arena. r=njn
--HG--
extra : rebase_source : 7ddcabf5385f2fc975cf44e4eb6ccdc890d6b7e2
2017-09-21 14:24:37 +09:00
Mike Hommey 46c03f6281 Bug 1402174 - Add an arena argument to imalloc, ipalloc and iralloc. r=njn
--HG--
extra : rebase_source : 60c1ef94e4014f7ef688263541653529e63216d8
2017-09-21 13:58:17 +09:00
Mike Hommey c6730d314b Bug 1402174 - Merge imalloc and icalloc into a single function. r=njn
--HG--
extra : rebase_source : ee06bd77753e94503ce207db8608515a27ef8ea4
2017-09-21 13:23:22 +09:00
Mike Hommey e9474c957e Bug 1402174 - Move AlignedAllocator around, so that calloc, realloc and free and grouped with malloc and memalign. r=njn
--HG--
extra : rebase_source : 139ffe643ca4c6e21f1426c06e92c5d80b32eb3d
2017-09-21 11:46:57 +09:00
Sebastian Hengst 836fbd6f31 Backed out changeset 14dac365b5f6 (bug 1402174) for frequently asserting rbp_i_cmp > 0, at mozjemalloc.cpp:2381. r=backout 2017-09-22 16:48:08 +02:00
Sebastian Hengst 55910de1c7 Backed out changeset 5bba0584a7d8 (bug 1402174) 2017-09-22 16:47:25 +02:00