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

489 Коммитов

Автор SHA1 Сообщение Дата
Mark Banner 15cfe23b88 Bug 1620542 - Automatically fix ESLint errors in .eslintrc.js files. r=mossop
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D65703

--HG--
extra : moz-landing-system : lando
2020-03-07 10:09:44 +00:00
Nicholas Nethercote e275a8b6cb Bug 1620151 - Improve the imprecise stack matching used for `test_dmd.js`. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D65454

--HG--
extra : moz-landing-system : lando
2020-03-05 21:40:52 +00:00
Nicholas Nethercote c22c891c55 Bug 1604095 - Add `fix_stacks.py`, which uses `fix-stacks`, and use it in DMD. r=gsvelto
On Linux and Mac, this makes `dmd.py` *much* faster when it is first run on a
DMD data file.

On Windows, this makes DMD actually usable locally. Previously the stacks
weren't fixed and so were rubbish.

Differential Revision: https://phabricator.services.mozilla.com/D57271

--HG--
extra : moz-landing-system : lando
2020-03-05 00:24:23 +00:00
Andrew McCreight 4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Ciure Andrei 00dd87f6f4 Backed out changeset d407a28318e6 (bug 1609815) for causing windows ming bustages CLOSED TREE
--HG--
extra : histedit_source : b2c748e31e0f6ba8fcf9960a336e0bbd361b07e6
2020-02-27 07:05:19 +02:00
Andrew McCreight b197e1f783 Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 04:43:48 +00:00
Masatoshi Kimura 11a443c5ea Bug 1615896 - Stop using CreateFileA in memory/replace/logalloc/. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D63023

--HG--
extra : moz-landing-system : lando
2020-02-20 08:05:25 +00:00
Nicholas Nethercote 7e767dd845 Bug 1614875 - Tweak constants to prevent saturation and improve the hit rate. r=glandium
With the old constants the page alloc slots would fill up quickly and the hit
rate would quickly drop below 20%.

With the new constants the alloc slots don't fill up so quickly and the hit
rate remains at or near 100% for a lot longer. Also, page allocs are recycled
more slowly, which should increase the likelihood of UAFs being detected
correctly.

Differential Revision: https://phabricator.services.mozilla.com/D62539

--HG--
extra : moz-landing-system : lando
2020-02-13 08:37:42 +00:00
Nicholas Nethercote 04df451726 Bug 1614875 - Gather more stats in PHC. r=glandium
Specifically, the number of page allocs in use, and the page alloc hit rate.

Differential Revision: https://phabricator.services.mozilla.com/D62538

--HG--
extra : moz-landing-system : lando
2020-02-13 08:37:40 +00:00
Emilio Cobos Álvarez 256c124f94 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:

This was done by applying:

```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
         from subprocess import Popen, PIPE, check_output, CalledProcessError

         diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
-        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']

         if not output_file:
             args.append("-i")
```

Then running `./mach clang-format -c <commit-hash>`

Then undoing that patch.

Then running check_spidermonkey_style.py --fixup

Then running `./mach clang-format`

I had to fix four things:

 * I needed to move <utility> back down in GuardObjects.h because I was hitting
   obscure problems with our system include wrappers like this:

0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94              ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94                                ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)

   Which I really didn't feel like digging into.

 * I had to restore the order of TrustOverrideUtils.h and related files in nss
   because the .inc files depend on TrustOverrideUtils.h being included earlier.

 * I had to add a missing include to RollingNumber.h

 * Also had to partially restore include order in JsepSessionImpl.cpp to avoid
   some -WError issues due to some static inline functions being defined in a
   header but not used in the rest of the compilation unit.

Differential Revision: https://phabricator.services.mozilla.com/D60327

--HG--
extra : moz-landing-system : lando
2020-01-20 16:19:48 +00:00
Emilio Cobos Álvarez aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'

Further manual fixups and cleanups to the include order incoming.

Differential Revision: https://phabricator.services.mozilla.com/D60323

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:20 +00:00
Brian Hackett f74708b30a Bug 1598951 Part 2 - Don't record random numbers in jemalloc, r=glandium.
Depends on D58437

Differential Revision: https://phabricator.services.mozilla.com/D58440

--HG--
extra : moz-landing-system : lando
2020-01-10 05:26:10 +00:00
Simon Giesecke 97827bec40 Bug 1601590 - Undef _FORTIFY_SOURCE to fix build with --warnings-on-errors. r=glandium
This is required on some systems such as Fedora to allow
building with -O0 together with --warnings-as-errors due to
a check in /usr/include/features.h

Differential Revision: https://phabricator.services.mozilla.com/D56696

--HG--
extra : moz-landing-system : lando
2019-12-12 01:59:13 +00:00
Nicholas Nethercote 928e9e1d00 Bug 1594598 - Use uint8_t* to avoid a bunch of casts. r=glandium
Currently the PHC code uses char* and uintptr_t in various address
computations. This patch changes it to use uint8_t* instead, which is clearer
than char* and avoids the need for various casts.

Differential Revision: https://phabricator.services.mozilla.com/D43840

--HG--
extra : moz-landing-system : lando
2019-11-06 23:56:48 +00:00
Nicholas Nethercote 3f17b826e9 Bug 1594598 - Improve some PHC comments. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D43838

--HG--
extra : moz-landing-system : lando
2019-11-06 23:56:48 +00:00
Nicholas Nethercote fb493c1481 Bug 1594598 - Tweak the control flow in MaybePageAlloc()'s loop. r=glandium
This reduces the indentation level by one for most of the loop body.

Differential Revision: https://phabricator.services.mozilla.com/D43837

--HG--
extra : moz-landing-system : lando
2019-11-06 23:52:31 +00:00
Nicholas Nethercote 956102ca29 Bug 1594598 - Fix some broken PHC_LOGGING code. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D42267

--HG--
extra : moz-landing-system : lando
2019-11-06 23:52:15 +00:00
Nicholas Nethercote adb9edf389 Bug 1574388 - Implement PHC on Mac. r=gsvelto,glandium
But it is not yet enabled; bug 1576515 will do that.

Differential Revision: https://phabricator.services.mozilla.com/D42264

--HG--
extra : moz-landing-system : lando
2019-08-25 23:16:05 +00:00
Sylvestre Ledru 645f2d5773 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D41559

--HG--
extra : moz-landing-system : lando
2019-08-13 07:15:25 +00:00
Mike Hommey c159931fbc Bug 1571505 - Properly add dbghelp where needed. r=nalexander
While here, properly export StackWalk.h when building with
--enable-project=memory.

Differential Revision: https://phabricator.services.mozilla.com/D40731

--HG--
extra : moz-landing-system : lando
2019-08-06 18:14:12 +00:00
Cameron McCormack d075470483 Bug 1053379 - Simplify CodeAddressService so non-DMD users can rely on defaults. r=njn
None of the StringTable implementations were freeing their strdup'd
strings, either.

Differential Revision: https://phabricator.services.mozilla.com/D40757

--HG--
extra : moz-landing-system : lando
2019-08-06 21:58:12 +00:00
Nicholas Nethercote e38691d6e6 Bug 1569862 - Implement PHC on Windows. r=glandium
The most important part is the `GetPHCAddrInfo()` function in
`exception_handler.cc`, which extracts a crash address from an
`EXCEPTION_POINTERS` object.

The commit also changes the code so that it works if MozStackWalk() returns an
empty stack trace. This happens in practice on Windows on automation sometimes,
I'm not sure why.

The rest of the commit is just plumbing and the smoothing over of minor
platform differences.

Differential Revision: https://phabricator.services.mozilla.com/D39841

--HG--
extra : moz-landing-system : lando
2019-08-02 00:33:04 +00:00
Nicholas Nethercote 38dbbfcffc Bug 1523276 - Implement PHC, a probabilistic heap checker. r=glandium,gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D25021

--HG--
extra : rebase_source : 86e94499f746b18a596130341692c6a9992d4867
2019-07-03 09:26:11 +10:00
Victor Porof feaa92296b Bug 1561435 - Format memory/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35912

--HG--
extra : source : ae1388f34f73a8628d46d49ca0de9577a20bf650
2019-07-05 10:51:11 +02:00
Nick Thomas 1048178580 Bug 1559975 - enable py2 and py3 linting in memory r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D35251

--HG--
extra : moz-landing-system : lando
2019-06-28 18:53:28 +00:00
Nicholas Nethercote 653456467a Bug 1533240 - Replace DMD's custom TLS code with use of mozilla/ThreadLocal.h. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D22448

--HG--
extra : moz-landing-system : lando
2019-03-22 20:07:30 +00:00
Edwin Gao b0ed46de2e Bug 1536250 - disable test_dmd.js r=jmaher
Disable this test which intermittently fails in xpcshell.

Differential Revision: https://phabricator.services.mozilla.com/D23956

--HG--
extra : moz-landing-system : lando
2019-03-19 01:12:08 +00:00
Gurzau Raul 0f47ac1ab9 Backed out changeset 46f6705f9c0c (bug 1533240) for xpcshell failures at /test/test_dmd.js on a CLOSED TREE. 2019-03-14 07:03:38 +02:00
Nicholas Nethercote f3a720ae86 Bug 1533240 - Replace DMD's custom TLS code with use of mozilla/ThreadLocal.h. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D22448

--HG--
extra : moz-landing-system : lando
2019-03-14 01:05:15 +00:00
Ryan Hunt bc6f68363a Bug 1523969 part 16 - Move method definition inline comments to new line in 'memory/'. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D21117

--HG--
extra : rebase_source : 73bb987caf0e10f7168610a3d6d3b993afeb7dd3
2019-02-25 16:10:15 -06:00
Nicholas Nethercote e01d4bc8cc Bug 1531027 - Add an explicit copy constructor to StackTrace. r=ehsan
This only copies the first `mLength` elements in `mPcs`.

Differential Revision: https://phabricator.services.mozilla.com/D21488

--HG--
extra : rebase_source : 91601501056fe7ea5b011adeca59033568fbde4a
2019-02-28 11:00:14 +11:00
Nicholas Nethercote 3494926e55 Bug 1531029 - Fix incorrect `sizeof` expression. r=ehsan
This doesn't change behaviour because `sizeof(uintptr_t)` equals
`sizeof(uintptr_t*)`, but it's good to make things more obviously correct.

Differential Revision: https://phabricator.services.mozilla.com/D21487

--HG--
extra : rebase_source : 4df36d1d1e85a671c297e6e761b44b7da5b85343
2019-02-28 11:05:34 +11:00
Ehsan Akhgari 1ca16ce872 Bug 1531027 - Make InfallibleAllocPolicy::new_ accept its argument as a reference; r=njn
Differential Revision: https://phabricator.services.mozilla.com/D21486

--HG--
extra : moz-landing-system : lando
2019-02-28 06:41:09 +00:00
Mike Hommey 9ca5062588 Bug 1530562 - Set SmokeDMD compiler flags depending on compiler type rather than target OS. r=mshal
Differential Revision: https://phabricator.services.mozilla.com/D21161

--HG--
extra : moz-landing-system : lando
2019-02-26 22:06:37 +00:00
Nicholas Nethercote 06e15020fe Bug 1529452 - Fix a silly bug. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D20772

--HG--
extra : moz-landing-system : lando
2019-02-22 10:52:03 +00:00
Nicholas Nethercote 4e8b423a96 Bug 1529452 - Avoid a multiplication that could overflow. r=glandium
Also add a comment about another multiplication.

Differential Revision: https://phabricator.services.mozilla.com/D20617

--HG--
extra : moz-landing-system : lando
2019-02-21 04:28:15 +00:00
Masatoshi Kimura e59e3b3e20 Bug 1528651 - Fix some trivial warnings and re-enable warnings-as-errors on Windows in some directories. r=dmajor
--HG--
extra : source : 5ee9efeda9e67f6af0521be85266703763cc4c50
2019-02-19 20:42:11 +09:00
Myk Melez 25349d2601 Bug 1518283 - prohibit blank lines at the beginning and end of blocks (eslint padded-blocks) r=mossop,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D17526

--HG--
extra : moz-landing-system : lando
2019-01-30 17:26:25 +00:00
Kris Maglione e930b89c34 Bug 1514594: Part 3 - Change ChromeUtils.import API.
***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8

This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:

  ChromeUtils.import("resource://gre/modules/Services.jsm");

is approximately the same as the following, in the new model:

  var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs

This was done using the followng script:

https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16750

--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
2019-01-17 10:18:31 -08:00
Ehsan Akhgari e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Andrew McCreight 4f8e71a1ca Bug 1519224 - Fix stack frame printing in block_analyzer.py. r=erahm
Also, add a new allocator function.

Differential Revision: https://phabricator.services.mozilla.com/D16241

--HG--
extra : moz-landing-system : lando
2019-01-14 18:41:35 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Nicholas Nethercote 953ed1dcc1 Bug 1499907 - Add a `jsonEscape` argument to `fixSymbols`. r=erahm
So that dmd.py isn't broken by function names that, after stack fixing, contain
escape-worthy chars such as " and /.

--HG--
extra : rebase_source : 625cef56e4599bbb810273ef04af2b971e777b58
2018-11-21 10:28:00 +11:00
Chris Martin adde9e8556 Bug 1402282 - Change jemalloc to use secure random private arena ids r=glandium
Previously the id for a new arena was just a counter that increased by one
every time. For hardening purposes, we want to make private arenas use a secure
random ID, so an attacker will have a more difficult time finding the memory
they are looking for.

Differential Revision: https://phabricator.services.mozilla.com/D10158

--HG--
extra : moz-landing-system : lando
2018-11-21 01:52:26 +00:00
Mark Banner 50fbf54ef3 Bug 1506559 - Enable ESLint for memory/replace/dmd/test/. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D11619

--HG--
extra : moz-landing-system : lando
2018-11-13 09:07:38 +00:00
arthur.iakab 27754a7d12 Backed out 2 changesets (bug 1402282) for turning multiple browser chrome bugs into permafail
Backed out changeset db7059b57f92 (bug 1402282)
Backed out changeset cea1d44ac776 (bug 1402282)
2018-11-05 17:56:37 +02:00
Chris Martin 3824b0d43e Bug 1402282 - Change jemalloc to use secure random arena ids r=glandium
Previously the id for a new arena was just a counter that increased by one
every time. For hardening purposes, we want to make the new counter a secure
random ID, so an attacker will have a more difficult time finding the memory
they are looking for.

Differential Revision: https://phabricator.services.mozilla.com/D10158

--HG--
extra : moz-landing-system : lando
2018-11-05 00:27:31 +00:00
Noemi Erli 06a8cd8e3c Backed out changeset bee1c344cb47 (bug 1491909) for failures in browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js 2018-10-24 04:23:13 +03:00
Denis Palmeiro fc930ad16f Bug 1491909 - Add an AllocPolicy to mozilla::JSONWriter r=jwalden,mstange
JSONWriter currently calls new and delete indirectly through mozilla::MakeUnique to allocate a buffer.  Becuase of this, the methods of this class cannot be invoked within Spidermonkey due to https://searchfox.org/mozilla-central/source/config/check_vanilla_allocations.py#6-14.  Therefore, JSONWriter needs an AllocPolicy template parameter so that the allocation and deallocation routines can be changed to match the JS AllocPolicy when invoked within SpiderMonkey.

Differential Revision: https://phabricator.services.mozilla.com/D7279

--HG--
extra : moz-landing-system : lando
2018-10-23 20:46:31 +00:00
Randell Jesup 0f390bf1a5 Bug 1480430: Modify jemalloc to allow dynamic replacement r=glandium 2018-10-09 22:28:37 -04:00
Eric Rahm c5bb74ff5d Bug 1409739 - Part 1: Accept SmokeDMD when filtering test DMD stacks. r=njn
On some builds we only get 'SmokeDMD' references during testing rather than a full file path. This adds 'SmokeDMD' to the acceptable frame description list.

--HG--
extra : rebase_source : 475166fa6d1f241bf4d67cbdda1aab73000a5c3a
extra : intermediate-source : fcdc1d5eaf1a932992287074d0c91504dd7180d8
extra : source : 1192c15fc9347ccd6169dcb5bea81d7f2399e3fd
2018-10-01 16:38:17 -07:00
Cosmin Sabou 5a8eb92385 Backed out 3 changesets (bug 1409739) for causing Linux x64 ccov & fuzzing bustages. a=backout
Backed out changeset 387f946c7c48 (bug 1409739)
Backed out changeset 617288a6b2d9 (bug 1409739)
Backed out changeset fcdc1d5eaf1a (bug 1409739)
2018-10-03 20:29:42 +03:00
Eric Rahm 703da53d94 Bug 1409739 - Part 1: Accept SmokeDMD when filtering test DMD stacks. r=njn
On some builds we only get 'SmokeDMD' references during testing rather than a full file path. This adds 'SmokeDMD' to the acceptable frame description list.

--HG--
extra : source : 1192c15fc9347ccd6169dcb5bea81d7f2399e3fd
extra : intermediate-source : d39c2dfcc7004a4736436c564de239ba68b20c03
extra : histedit_source : 5a75a20f5b88481c994597da81fdbc29186aba3d%2C3f60f2bfbe54ab3843d4b18d66296cd4aadf4a30
2018-10-01 16:38:17 -07:00
Coroiu Cristina 7f6d72d2a2 Backed out 3 changesets (bug 1409739) for xpcshell failures at memory/replace/dmd/test/test_dmd.js
Backed out changeset dc3c5143ba4e (bug 1409739)
Backed out changeset e37ea5eb932a (bug 1409739)
Backed out changeset d39c2dfcc700 (bug 1409739)
2018-10-03 02:07:19 +03:00
Eric Rahm 6566498f9e Bug 1409739 - Part 1: Accept SmokeDMD when filtering test DMD stacks. r=njn
On some builds we only get 'SmokeDMD' references during testing rather than a full file path. This adds 'SmokeDMD' to the acceptable frame description list.

--HG--
extra : rebase_source : 2b1d2dbf8a3a538533554c6697f0e9ee51ec1bed
extra : source : 1192c15fc9347ccd6169dcb5bea81d7f2399e3fd
2018-10-01 16:38:17 -07:00
Gurzau Raul 4f0690bc0d Backed out 3 changesets (bug 1409739) for failing at /dmd/test/test_dmd.js on a CLOSED TREE
Backed out changeset 39c8abcf9cb2 (bug 1409739)
Backed out changeset c0da83c08b62 (bug 1409739)
Backed out changeset 1192c15fc934 (bug 1409739)
2018-10-02 18:43:32 +03:00
Eric Rahm 0196b4c2ca Bug 1409739 - Part 1: Accept SmokeDMD when filtering test DMD stacks. r=njn
On some builds we only get 'SmokeDMD' references during testing rather than a full file path. This adds 'SmokeDMD' to the acceptable frame description list.

--HG--
extra : rebase_source : 147e62e22248971980d95fe211c86116a98cbdf4
2018-10-01 16:38:17 -07:00
Tom Ritter 934ba40bb8 Bug 1480457-Correct typedef so it matches an earlier typedef r=aklotz
--HG--
extra : amend_source : c6796d3a8bb13939440b390ac9af11054b46dd15
2018-08-30 23:05:59 +03:00
Nicholas Nethercote b9e071e2e8 Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink
Entry storage allocation now occurs on the first lookupForAdd()/put()/putNew().
This removes the need for init() and initialized(), and matches how
PLDHashTable/nsTHashtable work. It also removes the need for init() functions
in a lot of types that are built on top of mozilla::Hash{Map,Set}.

Pros:

- No need for init() calls and subsequent checks.

- No memory allocated for empty tables, which are not that uncommon.

Cons:

- An extra branch in lookup() and lookupForAdd(), but not in put()/putNew(),
  because the existing checkOverloaded() can handle it.

Specifics:

- Construction now can take a length parameter.

- init() is removed. Explicit length-setting, when necessary, now occurs in the
  constructors.

- initialized() is removed.

- capacity() now returns zero when the entry storage is absent.

- lookupForAdd() is no longer `const`, because it can instantiate the storage,
  which requires modifications.

- lookupForAdd() can now return an invalid AddPtr in two cases:

  - old: hashing failure (due to OOM in the hasher)

  - new: OOM while instantiating entry storage

  The existing failure handling paths for the old case work for the new case.

- clear(), finish(), and clearAndShrink() are replaced by clear(), compact(),
  and reserve(). The old compactIfUnderloaded() is also removed.

- Capacity computation code is now in its own functions, bestCapacity() and
  hashShift(). setTableSizeLog2() is removed.

- uint32_t is used throughout for capacities, instead of size_t, for
  consistency with other similar values.

- changeTableSize() now takes a capacity instead of a deltaLog2, and it can now
  handle !mTable.

Measurements:

- Total source code size is reduced by over 900 lines. Also, lots of existing
  lines got shorter (i.e. two checks were reduced to one).

- Executable size barely changed, down by 2 KiB on Linux64. The extra branches
  are compensated for by the lack of init() calls.

- Speed changed negligibly. The instruction count for Bench_Cpp_MozHash
  increased from 2.84 billion to 2.89 billion but any execution time change was
  well below noise.
2018-08-10 18:00:29 +10:00
Masatoshi Kimura 3b21b7868b Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : c09366fb93e5b0f72abe1e99d3094e3d96a934fb
extra : intermediate-source : 5950c9d63c3b4fd63a25464a7b50944aaec7079f
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00
Cosmin Sabou de8c2bd891 Backed out changeset 5950c9d63c3b (bug 1090497) for build bustages on several files. CLOSED TREE 2018-08-02 19:59:53 +03:00
Masatoshi Kimura feea19030c Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : a62521fdc66def4e4d5d7bf52e68365a786b5c55
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00
Nicholas Nethercote a4cfd53308 Bug 1478879 - Remove Range/Enum use in DMD. r=mccr8
--HG--
extra : rebase_source : 19428e3d0d1b8676fe55be729b0e75d787086b6c
2018-07-27 12:21:01 +10:00
Nicholas Nethercote 6141e31ef4 Bug 1479954 - Rename Hash{Set,Map}::sizeOf{In,Ex}cludingThis(). r=luke
In PLDHashTable the equivalent functions have a "Shallow" prefix, which makes
it clear that they don't measure things hanging off the table. This patch makes
mozilla::Hash{Set,Map} do likewise.

MozReview-Commit-ID: 3kwCJynhW7d

--HG--
extra : rebase_source : 9c03d11f376a9fd4cfd5cfcdc0c446c00633b210
2018-08-01 09:57:52 +10:00
Nicholas Nethercote 6998f465ed Bug 1477626 - Use mozilla::HashTable instead of JS::HashTable in DMD. r=erahm
Also use mozilla::HashNumber where appropriate.

MozReview-Commit-ID: BTq0XDS5UfQ

--HG--
extra : rebase_source : 28f45a9b27e831e99620a2b575f373003f1301f2
2018-07-26 20:15:58 +10:00
Brian Hackett f6b8e6f81c Bug 1309552 - Specify buffer size when freeing data in AllocPolicy, r=waldo.
--HG--
extra : rebase_source : f4e2d9f8831cf41c19d592ce252e87161f32250b
2018-07-20 23:58:34 +00:00
Eric Rahm ca834a09a7 Bug 1470268 - Add allocation filter to dmd.py. r=njn
This adds an '--allocation-filter' param that can be used to limit output to
only allocations that include the filter in their stack. For example:
  dmd.py --allocation-filter fontconfig dmd.json.gz
limits its output to just allocations that have an instance of 'fontconfig' in
in one of their stack frames.

--HG--
extra : rebase_source : 9ed34d5c7a6a2b76e96455e66b2e8196686ade16
2018-06-20 13:11:50 -07:00
Sylvestre Ledru 3e84d308c3 Bug 1464869 - Fix flake8/pep8 issue by hand in memory/ r=njn
MozReview-Commit-ID: 8bkhAB4g6rv

--HG--
extra : rebase_source : 623f4ed95d601b47878c910859f3b91e87897011
2018-05-25 23:27:02 -07:00
Sylvestre Ledru 21f28e8329 Bug 1464869 - Run autopep8 on memory/ r=njn
MozReview-Commit-ID: GzFGXZ8WLX5

--HG--
extra : rebase_source : 15b2f8fefaa4ee32a4f655086194202d9e82efb6
2018-05-25 23:16:07 -07:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Andreea Pavel 8469234a9f Bug 1461964 - removed mac 10.6 reference r=njn 2018-05-20 23:08:00 +03:00
David Major fa8d998487 Bug 1447795: Add even more UseItOrLoseIt to SmokeDMD.cpp 2018-04-01 09:37:42 -04:00
David Major 0fab6b57fc Bug 1447795 - Add some more UseItOrLoseIt to SmokeDMD.cpp. r=njn 2018-03-21 13:52:00 +02:00
Mike Hommey 61d75ea276 Bug 1442468 - Remove workaround for http://code.google.com/p/android/issues/detail?id=23203. r=froydnj
That NDK bug has been fixed since r8c, and we now require something more
recent than that. This effectively reverts the changes from bug 720621
and bug 734832.

--HG--
extra : rebase_source : 9ff76a790ec4135dc0172cfd0f11fc1ecef7df64
2018-03-01 15:15:02 +09:00
Florian Quèze c714053d73 Bug 1433175 - scripted patch to replace Components.classes[, Components.interfaces.nsI, Components.utils. and Components.results. with Cc, Ci, Cu and Cr, r=Mossop. 2018-02-28 18:51:33 +01:00
Kris Maglione 918ed6c474 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
extra : intermediate-source : 34c999fa006bffe8705cf50c54708aa21a962e62
extra : histedit_source : b2be2c5e5d226e6c347312456a6ae339c1e634b0
2018-01-29 15:20:18 -08:00
Cosmin Sabou 9a65a40178 Backed out 3 changesets (bug 1431533) for Android mochitest failures on testEventDispatcher on a CLOSED TREE
Backed out changeset a1eca62826a1 (bug 1431533)
Backed out changeset 34c999fa006b (bug 1431533)
Backed out changeset e2674287e57f (bug 1431533)
2018-01-30 07:17:48 +02:00
Kris Maglione 6476f95b13 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : source : 12fc4dee861c812fd2bd032c63ef17af61800c70
2018-01-29 15:20:18 -08:00
Brindusan Cristian af8879d1eb Backed out 2 changesets (bug 1431533) for ESlint failures on a CLOSED TREE
Backed out changeset 6e56f4c8843e (bug 1431533)
Backed out changeset 12fc4dee861c (bug 1431533)
2018-01-30 02:32:43 +02:00
Kris Maglione c276bb9375 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl

--HG--
extra : rebase_source : c004a023389f1f6bf3d2f3efe93c13d423b23ccd
2018-01-29 15:20:18 -08:00
Marco Castelluccio 871dbb2b23 Bug 1403005 - Don't run memory/replace/logalloc/replay in coverage builds. r=glandium
--HG--
extra : rebase_source : b2f451d764f8efb92082d8b987e74744091bfe4c
2018-01-16 15:45:40 +01:00
Chris Peterson 37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Sylvestre Ledru 9bfe27d903 Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 7duJk2gSd4m

--HG--
extra : rebase_source : 7312fe276e561e8c034a5f6749774ae812727f9c
2017-12-07 22:09:15 +01:00
Mike Hommey c6b6415a7b Bug 1423512 - Remove unnecessary XPCOM_GLUE define in DMD. r=njn
This was added in bug 1122337 back when the stackwalker was still
in XPCOM, which it isn't anymore, so XPCOM_GLUE is not necessary
anymore.

--HG--
extra : rebase_source : e550671c26e250843d34cb2b83497c861225883f
2017-12-06 09:52:55 +09:00
David Major ad7ff3a791 Bug 1423287 - Simplify NtCurrentTeb() handling. r=njn 2017-12-06 09:36:00 -05:00
Mike Hommey 3f1f5c9fc2 Bug 1423114 - Remove moz_xposix_memalign and moz_xvalloc. r=njn
They are both infallible wrappers of posix_memalign and valloc.
There is also moz_xmemalign, which wraps memalign, which is mostly
always available as of bug 1402647.

None of them are actually used, but it's still desirable to at least
have one infallible variant, so keep moz_xmemalign and remove the other
two.

While here, we actually make both memalign and moz_xmemalign always
available.

--HG--
extra : rebase_source : 1c3ca4b3e3310543145f3181dfa4e764be1d6ff8
2017-12-05 17:34:19 +09:00
Narcis Beleuzu dfd58840d1 Backed out changeset 8a4050c7e0fd (bug 1423114) for bustages on memory/mozalloc/mozalloc.cpp r=backout on a CLOSED TREE 2017-12-06 00:27:11 +02:00
Mike Hommey 5f1f0bbdc4 Bug 1423114 - Remove moz_xposix_memalign and moz_xvalloc. r=njn
They are both infallible wrappers of posix_memalign and valloc.
There is also moz_xmemalign, which wraps memalign, which is always
available as of bug 1402647.

None of them are actually used, but it's still desirable to at least
have one infallible variant, so keep moz_xmemalign and remove the other
two.

While here, we actually make moz_xmemalign always available, since
memalign is always available.

--HG--
extra : rebase_source : 17300bc03a715e5d36b4b687f22050622c1c70c8
2017-12-05 17:34:19 +09:00
Mike Hommey b796bc0e6d Bug 1423000 - Run clang-format in memory/replace/logalloc. r=njn
--HG--
extra : rebase_source : 6372d6eb88bad9da824e6a2a99380554e1ae04f5
2017-12-05 08:28:32 +09:00
Mike Hommey 55b2629bb8 Bug 1423000 - Always log allocator function calls. r=njn
So far, logalloc has avoided logging calls that e.g. return null
pointers, but both to make the code more generic and to enable logging
of error conditions, we now log every call.

--HG--
extra : rebase_source : 5e41914552f44e330f8f9c12b34fd6d30fdf30a7
2017-11-30 07:55:12 +09:00
Mike Hommey c617c4a119 Bug 1423000 - Don't use a separate replace-malloc library for the minimal-logalloc test. r=njn
Instead, only register a minimal set of functions when an environment
variable is set.

--HG--
extra : rebase_source : 94f2403ed9afe2acab1f56714d60fb32401076dc
2017-12-03 13:59:16 +09:00
Mike Hommey 2ff212b9f9 Bug 1423000 - Use mozjemalloc mutexes in logalloc. r=njn
Instead of the chromium one, which required some tricks.

--HG--
extra : rebase_source : f2918c33ff5263f50b81ac4606aa0ab3059cdc36
2017-12-03 14:23:23 +09:00
Mike Hommey 938618a5e1 Bug 1423000 - Reject some more invalid logalloc replay logs. r=njn
For functions with no result, such as free, it's invalid for some string
to appear after the closing parenthesis.

--HG--
extra : rebase_source : d7a72c064c408ba9c4a8722ebbaafb878633e857
2017-11-30 10:33:18 +09:00
Mike Hommey c142d8c12f Bug 1423000 - Move MemSlot lookup for replay results into the Replay methods. r=njn
This allows all methods to have the same signature.

--HG--
extra : rebase_source : 6c6e952d00ba5f92c2cf368fa871e8979f640780
2017-11-30 10:31:25 +09:00
Mike Hommey 94fe24fd79 Bug 1423000 - Count jemalloc_stats as an operation. r=njn
While jemalloc_stats is not actively doing anything, it can be
cumbersome to not have it count as an operation, because the operation
count shown on jemalloc_stats doesn't match the line number in the input
replay log, and the offset grows as the number of jemalloc_stats
operations grows.

While here, also update a comment about the replay log format.

--HG--
extra : rebase_source : da0ad9a990487ebdfadae7f8fcfad85e82b482fc
2017-11-30 10:18:39 +09:00
Mike Hommey ddec58883e Bug 1423000 - Remove Replay::Commit. r=njn
It adds an uncompressible and noticeable time overhead to replaying
logs, even when one is not interested in measuring RSS. This has caused
me to clear the method body on multiple occasions.

If necessary, it is possible to enable zero or junk at the allocator
level for the same effect.

--HG--
extra : rebase_source : a4c44e97986668e712b500266d7fffe985e85881
2017-11-30 10:48:41 +09:00
Mike Hommey 2b2a874b47 Bug 1420355 - Statically link DMD. r=njn
--HG--
extra : rebase_source : 8e7cf975d096116b666532f3fe8aa5a7f61b5725
2017-11-28 08:10:48 +09:00
Mike Hommey 50d09b60b0 Bug 1420355 - Allow to statically link replace-malloc libraries. r=njn
And statically link logalloc.

Statically linking is the default, except when building with
--enable-project=memory, allowing to use the generated libraries from
such builds with Firefox.

--HG--
extra : rebase_source : efe9edce8db6a6264703e0105c2192edc5ca8415
2017-11-23 17:24:19 +09:00
Mike Hommey 1e631092c5 Bug 1420355 - Don't initialize DMD if the DMD environment variable is not given. r=njn
This makes things slightly more inconvenient (having to set two
environment variables instead of one for the simplest case) until a few
patches down the line, when DMD is statically linked, at which point it
will get down to one environment variable every time.

--HG--
extra : rebase_source : 08dc3c05318b572ae1026227d0369fa8bf21b20f
2017-11-28 08:10:07 +09:00
Mike Hommey 7c59f18de8 Bug 1420355 - Don't initialize logalloc if MALLOC_LOG is not given. r=njn
Now that replace_init can opt-out of registering the replace-malloc
functions, don't do so when MALLOC_LOG was not set in the environment.

While one would normally set MALLOC_LOG alongside one of the environment
variable necessary to load the replace-malloc library, we're also going,
in a subsequent change, to allow statically linking replace-malloc
libraries, taking full advantage of this change.

--HG--
extra : rebase_source : 944a9d7af33f88f793ee0104bd5e58ec508e4f58
2017-11-23 13:54:16 +09:00
Mike Hommey 8b50bbe85b Bug 1420355 - Remove fallbacks when DMD is initializing. r=njn
As of bug 1420353, DMD's replace_* functions can't be called before
replace_init places them in the malloc function table, which only
happens after DMD::Init has run, meaning DMD is always initialized
by the time any of its replace_* function can be called.

--HG--
extra : rebase_source : 96bf4d01b6fac5cbb4712f56c572791cc4972f77
2017-11-28 08:05:58 +09:00
Mike Hommey 449973411b Bug 1420355 - Don't declare replace_* functions in replace_malloc.h. r=njn
The original purpose of those declarations was to avoid the function
definitions being wrong, as well as forcing them being exported
properly (as extern "C", as weak symbols when necessary, etc.), but:

- The implementations being C++, function overloads simply allowed
  functions with the same name to have a different signature.

- As of bug 1420353, the functions don't need to be exported anymore,
  nor do we care whether their symbols are mangled. Furthermore, they're
  now being assigned to function table fields, meaning there is type
  checking in place, now.

So all in all, these declarations can be removed.

Also, as further down the line we're going to statically link the
replace-malloc libraries, avoid symbol conflicts by making those
functions static.

--HG--
extra : rebase_source : 0dbb15f2c85bc873e7eb662b8d757f99b0732270
2017-11-28 07:18:15 +09:00
Mike Hommey 2b959b7c6e Bug 1420355 - Don't link logalloc against the static runtime on Windows. r=njn
This was never strictly required (for instance, DMD doesn't do that),
and would make things harder with the subsequent changes.

--HG--
extra : rebase_source : 29ea08d41f54da7f99120f9fe9af4017f61d8a4b
2017-11-28 17:11:40 +09:00
Csoregi Natalia 4ce8d0124c Backed out 7 changesets (bug 1420355) for mass failures on OS X and Android. r=backout on a CLOSED TREE
Backed out changeset a7ed89e13a4c (bug 1420355)
Backed out changeset fd6702e6e0a0 (bug 1420355)
Backed out changeset 0479dda078a2 (bug 1420355)
Backed out changeset e69357ccca9e (bug 1420355)
Backed out changeset 3742a4b69ba2 (bug 1420355)
Backed out changeset 451cd087922f (bug 1420355)
Backed out changeset d80b5c4e1dd0 (bug 1420355)
2017-11-29 03:08:46 +02:00
Mike Hommey 7c62087a43 Bug 1420355 - Statically link DMD. r=njn
--HG--
extra : rebase_source : 46800c9c0c5006a5a32f11abc209da27e65ae0f5
2017-11-28 08:10:48 +09:00
Mike Hommey d60e80991e Bug 1420355 - Allow to statically link replace-malloc libraries. r=njn
And statically link logalloc.

Statically linking is the default, except when building with
--enable-project=memory, allowing to use the generated libraries from
such builds with Firefox.

--HG--
extra : rebase_source : efe9edce8db6a6264703e0105c2192edc5ca8415
2017-11-23 17:24:19 +09:00
Mike Hommey 0a3b6c9813 Bug 1420355 - Don't initialize DMD if the DMD environment variable is not given. r=njn
This makes things slightly more inconvenient (having to set two
environment variables instead of one for the simplest case) until a few
patches down the line, when DMD is statically linked, at which point it
will get down to one environment variable every time.

--HG--
extra : rebase_source : 08dc3c05318b572ae1026227d0369fa8bf21b20f
2017-11-28 08:10:07 +09:00
Mike Hommey e38859b199 Bug 1420355 - Don't initialize logalloc if MALLOC_LOG is not given. r=njn
Now that replace_init can opt-out of registering the replace-malloc
functions, don't do so when MALLOC_LOG was not set in the environment.

While one would normally set MALLOC_LOG alongside one of the environment
variable necessary to load the replace-malloc library, we're also going,
in a subsequent change, to allow statically linking replace-malloc
libraries, taking full advantage of this change.

--HG--
extra : rebase_source : 944a9d7af33f88f793ee0104bd5e58ec508e4f58
2017-11-23 13:54:16 +09:00
Mike Hommey 3e3dbe9627 Bug 1420355 - Remove fallbacks when DMD is initializing. r=njn
As of bug 1420353, DMD's replace_* functions can't be called before
replace_init places them in the malloc function table, which only
happens after DMD::Init has run, meaning DMD is always initialized
by the time any of its replace_* function can be called.

--HG--
extra : rebase_source : 96bf4d01b6fac5cbb4712f56c572791cc4972f77
2017-11-28 08:05:58 +09:00
Mike Hommey ef6af827be Bug 1420355 - Don't declare replace_* functions in replace_malloc.h. r=njn
The original purpose of those declarations was to avoid the function
definitions being wrong, as well as forcing them being exported
properly (as extern "C", as weak symbols when necessary, etc.), but:

- The implementations being C++, function overloads simply allowed
  functions with the same name to have a different signature.

- As of bug 1420353, the functions don't need to be exported anymore,
  nor do we care whether their symbols are mangled. Furthermore, they're
  now being assigned to function table fields, meaning there is type
  checking in place, now.

So all in all, these declarations can be removed.

Also, as further down the line we're going to statically link the
replace-malloc libraries, avoid symbol conflicts by making those
functions static.

--HG--
extra : rebase_source : 0dbb15f2c85bc873e7eb662b8d757f99b0732270
2017-11-28 07:18:15 +09:00
Mike Hommey 8771ae803b Bug 1420355 - Don't link logalloc against the static runtime on Windows. r=njn
This was never strictly required (for instance, DMD doesn't do that),
and would make things harder with the subsequent changes.

--HG--
extra : rebase_source : 29ea08d41f54da7f99120f9fe9af4017f61d8a4b
2017-11-28 17:11:40 +09:00
Mike Hommey 32ecc64ada Bug 1420353 - Change how replace-malloc initializes, part 2. r=njn
Because one entry point is simpler than two, we make replace_init fulfil
both the roles of replace_init and replace_get_bridge.

Note this should be binary compatible with older replace-malloc
libraries, albeit not detecting their bridge (and with the
previous change, they do not register anyways). So loading older
replace-malloc libraries should do nothing, but not crash in awful ways.

--HG--
extra : rebase_source : aaf83e706ee34f45cfa75551a2f0998e5c5b8726
2017-11-24 16:02:05 +09:00
Mike Hommey 845f9c5d82 Bug 1420353 - Change how replace-malloc initializes, part 1. r=njn
The allocator API is a moving target, and every time we change it, the
surface for replace-malloc libraries grows. This causes some build
system problems, because of the tricks in replace_malloc.mk, which
require the full list of symbols.

Considering the above and the goal of moving some of the replace-malloc
libraries into mozglue, it becomes simpler to reduce the replace-malloc
exposure to the initialization functions.

So instead of the allocator poking into replace-malloc libraries for all
the functions, we expect their replace_init function to alter the table
of allocator functions it's passed to register its own functions.

This means replace-malloc implementations now need to copy the original
table, which is not a bad thing, as it allows function calls with one
level of indirection less. It also replace_init functions to not
actually register the replace-malloc functions in some cases, which will
be useful when linking some replace-malloc libraries into mozglue.

Note this is binary compatible with previously built replace-malloc
libraries, but because those libraries wouldn't update the function
table, they would stay disabled.

--HG--
extra : rebase_source : 2518f6ebe76b4c82359e98369de6a5a8c3ca9967
2017-11-22 17:24:29 +09:00
Mike Hommey 1f75d81c1c Bug 1417234 - Use SRWLock as Mutex for mozjemalloc on Windows. r=njn
SRWLock is more lightweight than CriticalSection, but is only available
on Windows Vista and more. So until we actually dropped support Windows
XP, we had to use CriticalSection.

Now that all supported Windows versions do have SRWLock, this is a
switch we can make, and not only because SRWLock is more lightweight,
but because it can be statically initialized like on other platforms,
allowing to use the same initialization code as on other platforms,
and removing the requirement for a DllMain, which in turn can allow
to statically link mozjemalloc in some cases, instead of requiring a
shared library (DllMain only works on shared libraries), or manually
call the initialization function soon enough.

There is a downside, though: SRWLock, as opposed to CriticalSection, is
not fair, meaning it can have thread scheduling implications, and can
theoretically increase latency on some threads. However, it is the
default used by Rust Mutex, meaning it's at least good enough there.
Let's see how things go with this.

--HG--
extra : rebase_source : 337dc4e245e461fd0ea23a2b6b53981346a545c6
2017-11-14 12:58:33 +09:00
Mike Hommey 5bf6af5d52 Bug 1229384 - Make pages_commit fallible. r=njn
This will make allocation operations return nullptr in the face of OOM,
allowing callers to either handle the allocation error or for the normal
OOM machinery, which also records the requested size, to kick in.

--HG--
extra : rebase_source : 723048645cb3f0db269c91f9d023bb06825a817b
2017-10-27 10:31:50 +09: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
Mike Hommey d4a847cce0 Bug 1401101 - Remove the generic replace-malloc library. r=njn
It is one of the moving parts when adding new memory allocation APIs.

It was added in bug 1168719 and the only thing that actually used it
was the sampling-based memory profiler, which was removed in bug
1385953. We however keep the replace-malloc bridge entry point so that
something else, in the future, may still provide the feature.

--HG--
extra : rebase_source : dd4a226171429e2a4ab5666b0873e7b945f161e6
2017-09-19 15:58:33 +09:00
Mike Hommey 05e3823899 Bug 1399350 - Remove jemalloc_*_impl macros. r=njn
Those macros are one more thing that needs to be added when the
mozjemalloc API surface is increased, but after bug 1399350, nothing
actually needs them, so remove them.

--HG--
extra : rebase_source : 2bf62cc6c179540482722a72b0d0c134d2ac2a19
2017-09-13 14:25:21 +09:00
Sebastian Hengst 6af41593df merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-09-12 11:37:58 +02:00
Mike Hommey 6981b76dbc No bug - Remove the TODO item that was implemented in bug 1300948. r=me 2017-09-12 16:34:43 +09:00
Chris Manchester c0a229d4c3 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP

--HG--
extra : rebase_source : 3cdee7528846462c758e623d6bcd2e6e17dbabff
2017-09-11 11:33:26 -07:00
Nicholas Nethercote c419d5fa48 Bug 1389305 (attempt 2) - Add jemalloc_ptr_info() and moz_malloc_enclosing_size_of(). r=glandium.
--HG--
extra : rebase_source : 93a6cfcc916fb239581c2892f24b24c6fc65ac71
2017-09-01 11:52:23 +10:00
Sebastian Hengst 4310ea4600 Backed out changeset f232b5b1a0c7 (bug 1389305) for frequently failing GTest Jemalloc.PtrInfo on Linux opt. r=backout 2017-08-31 13:52:48 +02:00
Nicholas Nethercote 365285b831 Bug 1389305 - Add jemalloc_ptr_info() and moz_malloc_enclosing_size_of(). r=glandium.
jemalloc_ptr_info() gives info about any pointer, such as whether it's within a
live or free allocation, and if so, info about that allocation. It's useful for
debugging.

moz_malloc_enclosing_size_of() uses jemalloc_ptr_info() to measure the size of
an allocation from an interior pointer. It's useful for memory reporting,
especially for Rust code.

--HG--
extra : rebase_source : caa19cccf8c2d1f79cf004fe6a408775de5a7b22
2017-08-24 19:37:27 +10:00
Mike Hommey 57c65279a0 Bug 1395088 - Remove the jemalloc_bool type. r=njn
Back when it was added (for Windows CE, in bug 488608), mozjemalloc was
C and all the supported compilers didn't support C99 bools. Now
mozjemalloc is C++, and all the supported compilers support C99 bools
for the cases where the type is used from C.

--HG--
extra : rebase_source : b9c710a0c48dc36cb473af59e3119131d13523ce
2017-08-30 18:04:47 +09:00
David Major 406287685a Bug 1391420: Set NO_PGO on a bunch of binaries that we don't ship. r=ted 2017-08-23 15:05:40 -04:00
Sebastian Hengst 142b3bf28b Backed out changeset 109e89a7d561 (bug 1391420) for busting Linux pgo builds. r=backout on a CLOSED TREE
--HG--
extra : amend_source : 6a4421254e4de31071785b73abdd1186638e31f2
2017-08-23 18:12:46 +02:00
David Major 8cb2cb650a Bug 1391420: Set NO_PGO on a bunch of binaries that we don't ship. r=ted 2017-08-23 11:10:39 -04:00
Nicholas Nethercote 57c26c9834 Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.

Here is an example of the output.

> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │  ├──12,772,544 B (12.26%) -- layout
> │  │  ├───4,483,744 B (04.30%) -- frames
> │  │  │   ├──1,653,552 B (01.59%) ── nsInlineFrame
> │  │  │   ├──1,415,760 B (01.36%) ── nsTextFrame
> │  │  │   ├────431,376 B (00.41%) ── nsBlockFrame
> │  │  │   ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │  │  │   ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │  │  │   ├────156,408 B (00.15%) ── nsBulletFrame
> │  │  │   ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │  │  │   ├─────27,656 B (00.03%) ── sundries
> │  │  │   ├─────23,520 B (00.02%) ── nsTableCellFrame
> │  │  │   ├─────16,704 B (00.02%) ── nsImageFrame
> │  │  │   ├─────15,488 B (00.01%) ── nsTableRowFrame
> │  │  │   ├─────13,776 B (00.01%) ── nsTableColFrame
> │  │  │   └─────13,376 B (00.01%) ── nsTableFrame
> │  │  ├───3,412,192 B (03.28%) -- servo-style-structs
> │  │  │   ├──1,288,224 B (01.24%) ── Display
> │  │  │   ├────742,400 B (00.71%) ── Position
> │  │  │   ├────308,736 B (00.30%) ── Font
> │  │  │   ├────226,512 B (00.22%) ── Background
> │  │  │   ├────218,304 B (00.21%) ── TextReset
> │  │  │   ├────214,896 B (00.21%) ── Text
> │  │  │   ├────130,560 B (00.13%) ── Border
> │  │  │   ├─────81,408 B (00.08%) ── UIReset
> │  │  │   ├─────61,440 B (00.06%) ── Padding
> │  │  │   ├─────38,176 B (00.04%) ── UserInterface
> │  │  │   ├─────29,232 B (00.03%) ── Margin
> │  │  │   ├─────21,824 B (00.02%) ── sundries
> │  │  │   ├─────20,080 B (00.02%) ── Color
> │  │  │   ├─────20,080 B (00.02%) ── Column
> │  │  │   └─────10,320 B (00.01%) ── Effects
> │  │  ├───2,227,680 B (02.14%) -- computed-values
> │  │  │   ├──1,182,928 B (01.14%) ── non-dom
> │  │  │   └──1,044,752 B (01.00%) ── dom
> │  │  ├───1,500,016 B (01.44%) ── text-runs
> │  │  ├─────492,640 B (00.47%) ── line-boxes
> │  │  ├─────326,688 B (00.31%) ── frame-properties
> │  │  ├─────301,760 B (00.29%) ── pres-shell
> │  │  ├──────27,648 B (00.03%) ── pres-contexts
> │  │  └─────────176 B (00.00%) ── style-sets

The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.

Other notable things done by the patch are as follows.

- It significantly changes the signatures of the methods measuring nsINode and
  its subclasses, in order to handle the tallying of style structs separately
  from element-nodes. Likewise for nsIFrame.

- It renames the 'layout/style-structs' sub-tree as
  'layout/gecko-style-structs', to clearly distinguish it from the new
  'layout/servo-style-structs' sub-tree.

- It adds some FFI functions to access various Rust-side data structures from
  C++ code.

- There is a nasty hack used twice to measure Arcs, by stepping backwards from
  an interior pointer to a base pointer. It works, but I want to replace it
  with something better eventually. The "XXX WARNING" comments have details.

- It makes DMD print a line to the console if it sees a pointer it doesn't
  recognise. This is useful for detecting when we are measuring an interior
  pointer instead of a base pointer, which is bad but easy to do when Arcs are
  involved.

- It removes the Rust code for measuring CVs, because it's now all done on the
  C++ side.

MozReview-Commit-ID: BKebACLKtCi

--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 16:37:33 +10:00
Nicholas Nethercote 710682624c Bug 1387940 - Make --max-frames=8 the default for dmd.py. r=mccr8.
The current default is 24, which is equal to the maximum number of stack frames
that DMD will record. And that's a terrible value because it splits up too many
related stack traces into separate records. There is no single best value, but
8 is a much better default.

--HG--
extra : rebase_source : c423fc4fe0e490ff6d58fa8f7116bc01c86a366e
2017-08-07 14:56:15 +10:00
Nicholas Nethercote 406a9ed175 Bug 1384819 (part 3) - Remove the return value from the stack walker functions. r=glandium.
Just one caller (in DMD) actually looks at it, and that's in an unimportant way
-- if the return value was false, mLength would be zero anyway.

--HG--
extra : rebase_source : 0463ab3765744742a9e854964342d631095fa55f
2017-07-27 16:46:55 +10:00
Nicholas Nethercote 8a20eb82d2 Bug 1384819 (part 2) - Tweak FramePointerStackWalk() arguments. r=glandium.
This patch does he following.

- Avoids some unnecessary casting.

- Renames the |bp| parameter as |aBp|.

- Makes the no-op FramePointerStackWalk() signature match the real one.
  (Clearly it's dead code in all built configurations!)

--HG--
extra : rebase_source : 3fe606d1ff9b063294f4028ff884c20661ed9e0a
2017-07-27 16:46:33 +10:00
Nicholas Nethercote 08e54b7c13 Bug 1384819 (part 1) - Split MozStackWalk(). r=glandium.
MozStackWalk() is different on Windows to the other platforms. It has two extra
arguments, which can be used to walk the stack of a different thread.

This patch makes those differences clearer. Instead of having a single function
and forbidding those two arguments on non-Windows, it removes those arguments
from MozStackWalk, and splits off MozStackWalkThread() which retains them. This
also allows those arguments to have more appropriate types (HANDLE instead of
uintptr_t; CONTEXT* instead of than void*) and names (aContext instead of
aPlatformData).

The patch also removes unnecessary reinterpret_casts for the aClosure argument
at a couple of MozStackWalk() callsites.

--HG--
extra : rebase_source : 111ab7d6426d7be921facc2264f6db86c501d127
2017-07-27 12:46:47 +10:00
Nicholas Nethercote f7a538edd4 Bug 1382076 - Use FramePointerStackWalk() in DMD on Win32. r=erahm.
The patch also uses a better value for skipFrames on Win64.

--HG--
extra : rebase_source : ef3d6d68fbea45e7fd571db2ba78904d97f5e21e
2017-07-20 11:33:31 +10:00
Nicholas Nethercote 4325ae218a Bug 1371397 - Use FramePointerStackWalk() in DMD on Mac. r=erahm.
This avoids MozStackWalk(), which has become unusably slow on Mac due to
changes in libunwind, and gets us back to decent speed.

The code for getting the frame pointer and stack end was copied from the Gecko
Profiler, which also uses FramePointerStackWalk() on Mac.

--HG--
extra : rebase_source : 58c32c2df8716c7c8123a4a8fb692182d066caca
2017-07-07 07:08:08 +10:00
Mike Hommey ed863255b4 Bug 1378592 - Remove MOZ_REPLACE_MALLOC_LINKAGE. r=froydnj
MOZ_REPLACE_MALLOC_LINKAGE was added back when there were problems with
getting weak references working properly for replace-malloc.

Versions of OSX < 10.6 needed flat namespace, but aren't supported
anymore.

Versions of Xcode < 4.5 required flat namespace + a dummy library in
order to produce proper weak references. There is virtually nobody still
building with such an ancient toolchain.

Keeping those around doesn't /really/ hurt, except recent versions of
Xcode don't expose dyldinfo in /usr/bin, used for the configure test.
Consequently, MOZ_REPLACE_MALLOC_LINKAGE ended up being set to use the
dummy library setup, which, by using flat namespace, now causes harm in
bug 1356701, causing bug 1378332.

--HG--
extra : rebase_source : e3edc1f2cf905943c33fafeb631f2f88fc87167e
2017-07-06 10:26:04 +09:00
Mike Hommey 1b12c351f2 Bug 1368932 - Add a testcase for a replace-malloc library that doesn't implement all functions. r=njn
--HG--
rename : memory/replace/logalloc/moz.build => memory/replace/logalloc/logalloc.mozbuild
rename : memory/replace/logalloc/replay/replay.log => memory/replace/logalloc/replay/expected_output_minimal.log
extra : rebase_source : 94f8fb4444e2e0ecda61e5ffd283ab560d1e9dfe
2017-05-31 15:04:32 +09:00
Mike Hommey 4ae1509807 Bug 1368932 - Handle missing replace_posix_memalign at the replace-malloc level. r=njn
Replace-malloc libraries, such as DMD, don't really need to care about
the details of implementing all the variants of aligned memory
allocation functions. Currently, by defining MOZ_REPLACE_ONLY_MEMALIGN
before including replace_malloc.h, they get predefined functions.

Instead of making that an opt-in at build time, we make the
replace-malloc initialization just fill the replace-malloc
malloc_table_t with implementations that rely on the replace_memalign
the library provides.

--HG--
extra : rebase_source : 0842a67d9bc27a9a86c33d14d98b9c25f39982fb
2017-05-31 13:47:17 +09:00
Mike Hommey 782725e19a Bug 1363992 - Remove jemalloc 4. r=njn
--HG--
extra : rebase_source : 9794320e96279cbb8b7b66db6720c959eaa6a95b
2017-05-11 13:23:07 +09:00
Mike Hommey 02a06f7958 Bug 1363992 - Remove support for making jemalloc4 the default. r=njn
--HG--
extra : rebase_source : 77e1c13aa329637d0ec875439d572ee06e6919fa
2017-05-11 13:16:00 +09:00
Julian Seward 83969e88eb Bug 1361258 - Add a jemalloc_thread_local_arena API with a binding for rust. r=glandium
The intent of the API is to allow threads to opt-in to use a separate
mozjemalloc arena.

This indroduces a dummy shell with no actual implementation.
2017-05-12 18:08:08 +09:00
Tom Tromey b4f2234e87 Bug 1334286 - use MOZ_FORMAT_PRINTF in DMD; r=njn
Add MOZ_FORMAT_PRINTF to the appropriate spots in DMD and fix up the
one (trivial) error that this pointed out.

MozReview-Commit-ID: LS0UWV5YRoM

--HG--
extra : rebase_source : eb09be39df61a51acd46ed72a1461c495727af79
2017-04-21 15:54:05 -06:00
Eric Rahm 3d78211d31 Bug 1349002 - Build DMD with unified sources. r=njn
DMD can be built with unified sources, additionally it doesn't need NSPR's
strcpy to build properly.

MozReview-Commit-ID: 9hZFlpWdt7
2017-03-21 12:24:43 -07:00
Wes Kocher 9b58353afe Backed out changeset 2f6d3cbedd12 (bug 1349002) for build bustage a=backout
MozReview-Commit-ID: DY4OupKVBlS
2017-03-20 18:08:43 -07:00
Eric Rahm 5b55122df3 Bug 1349002 - Build DMD with unified sources. r=njn
DMD can be built with unified sources, additionally it doesn't need NSPR's
strcpy to build properly.

MozReview-Commit-ID: 9hZFlpWdt7
2017-03-20 17:24:34 -07:00
Eric Rahm 6bb5fd3d99 Bug 1341621 - Avoid deadlocks in DMD when forking. r=njn
In order to avoid the possibility of a deadlock if the DMD state lock is
currently acquired when forking a |pthread_atfork| hook is added to wait for
and acquire the lock prior to forking, then release it after forking.
2017-02-23 17:47:02 -08:00
Emanuel Hoogeveen 9c7c14c872 Bug 1338574 - Part 1: Add MOZ_CRASH_UNSAFE_OOL and MOZ_CRASH_UNSAFE_PRINTF to crash with a runtime generated explanation string. r=froydnj
--HG--
extra : rebase_source : 3ba633aa77ab96f763ea03a8308c539c9c2aeda0
2017-02-21 18:01:41 +01:00
Sylvestre Ledru 6fd3084f65 Bug 1338086 - Remove useless else blocks in order to reduce complexity in memory/ r=njn
MozReview-Commit-ID: G7jBKlDHshQ

--HG--
extra : rebase_source : 4317651e0cc87b0be1230b19ceb844cfcb4842bc
2017-02-09 11:24:39 +01:00
Mike Hommey d1c271f02d Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r=njn
--HG--
extra : rebase_source : 83ef3414b74a5164b8535bdf266075d1076e0437
2016-11-30 07:22:20 +09:00
Emanuel Hoogeveen b324d2ba21 Bug 1315939 - Use FINAL_LIBRARY = 'memory' in jemalloc and mozjemalloc. r=glandium
--HG--
extra : rebase_source : 94d19e08090839537ca5174baa8b37993d108acc
2016-11-10 06:57:00 -05:00