Commit Graph

67 Commits

Author SHA1 Message Date
Mike Hommey
e16bc5652a 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.
2018-03-01 15:15:02 +09:00
Marco Castelluccio
8e12fabce0 Bug 1403005 - Don't run memory/replace/logalloc/replay in coverage builds. r=glandium 2018-01-16 15:45:40 +01:00
Mike Hommey
023abf4b35 Bug 1423000 - Run clang-format in memory/replace/logalloc. r=njn 2017-12-05 08:28:32 +09:00
Mike Hommey
67ba1da5be 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.
2017-11-30 07:55:12 +09:00
Mike Hommey
64f33bed35 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.
2017-12-03 13:59:16 +09:00
Mike Hommey
d85897af48 Bug 1423000 - Use mozjemalloc mutexes in logalloc. r=njn
Instead of the chromium one, which required some tricks.
2017-12-03 14:23:23 +09:00
Mike Hommey
afa5810ac9 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.
2017-11-30 10:33:18 +09:00
Mike Hommey
c53a246fe2 Bug 1423000 - Move MemSlot lookup for replay results into the Replay methods. r=njn
This allows all methods to have the same signature.
2017-11-30 10:31:25 +09:00
Mike Hommey
beed19bc62 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.
2017-11-30 10:18:39 +09:00
Mike Hommey
ad730700b9 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.
2017-11-30 10:48:41 +09:00
Mike Hommey
6841c321d6 Bug 1420355 - Statically link DMD. r=njn 2017-11-28 08:10:48 +09:00
Mike Hommey
f6ac2c4758 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.
2017-11-23 17:24:19 +09:00
Mike Hommey
1777dd3cd4 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.
2017-11-23 13:54:16 +09:00
Mike Hommey
9895b39cb5 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.
2017-11-28 07:18:15 +09:00
Mike Hommey
d56b7aa0dc 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.
2017-11-28 17:11:40 +09:00
Csoregi Natalia
e4966430b1 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
0a7b28a47e Bug 1420355 - Statically link DMD. r=njn 2017-11-28 08:10:48 +09:00
Mike Hommey
6172c3f450 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.
2017-11-23 17:24:19 +09:00
Mike Hommey
04e85c2655 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.
2017-11-23 13:54:16 +09:00
Mike Hommey
1cb0b4da51 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.
2017-11-28 07:18:15 +09:00
Mike Hommey
c3de8455e7 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.
2017-11-28 17:11:40 +09:00
Mike Hommey
c2552aaaea 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.
2017-11-24 16:02:05 +09:00
Mike Hommey
db02ee9925 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.
2017-11-22 17:24:29 +09:00
Mike Hommey
730ff37447 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.
2017-11-14 12:58:33 +09:00
Mike Hommey
4b8a14d828 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.
2017-10-27 10:31:50 +09:00
Mike Hommey
8df4ff9d68 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.
2017-09-13 14:25:21 +09:00
Sebastian Hengst
eb7fbf0906 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-09-12 11:37:58 +02:00
Mike Hommey
f591c25a4d No bug - Remove the TODO item that was implemented in bug 1300948. r=me 2017-09-12 16:34:43 +09:00
Chris Manchester
67a3d90503 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP
2017-09-11 11:33:26 -07:00
David Major
2f8a0aa015 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
cd3a8b86af Backed out changeset 109e89a7d561 (bug 1391420) for busting Linux pgo builds. r=backout on a CLOSED TREE 2017-08-23 18:12:46 +02:00
David Major
0aace12760 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
Mike Hommey
d3ca146523 Bug 1368932 - Add a testcase for a replace-malloc library that doesn't implement all functions. r=njn 2017-05-31 15:04:32 +09:00
Mike Hommey
1f354dbf2a Bug 1363992 - Remove support for making jemalloc4 the default. r=njn 2017-05-11 13:16:00 +09:00
Emanuel Hoogeveen
ba1459c85c Bug 1338574 - Part 1: Add MOZ_CRASH_UNSAFE_OOL and MOZ_CRASH_UNSAFE_PRINTF to crash with a runtime generated explanation string. r=froydnj 2017-02-21 18:01:41 +01:00
Sylvestre Ledru
c86cd0927f Bug 1338086 - Remove useless else blocks in order to reduce complexity in memory/ r=njn
MozReview-Commit-ID: G7jBKlDHshQ
2017-02-09 11:24:39 +01:00
Mike Hommey
605fdf3ce8 Bug 1321093 - Avoid logalloc-replay make check failure when libstdc++ allocates memory in some static initializer. r=njn 2016-11-30 07:22:20 +09:00
Emanuel Hoogeveen
2ab5f433fd Bug 1309573 - Part 2: Define MOZ_HAS_MOZGLUE in various places so that the crash reason gets used. r=glandium 2016-11-08 03:53:00 -05:00
Mike Hommey
e02f259e7a Bug 1303232 - Use per-process reduced thread-ids when munging logalloc logs. r=njn
Bug 1300948 added thread-ids to logalloc logs, and logalloc_munge.py was
munging them all as if they were all under the same namespace. But when
filtering munged logs to only contain logs from a given process,
thread-ids then don't necessarily start from 1, which would be the
desired outcome.

So use a different pool of thread-ids for each process.
2016-09-20 13:44:27 +09:00
Mike Hommey
478295f55b Bug 1300974 - Work around race condition leading to deadlock on fork when enabling LogAlloc. r=njn 2016-09-08 07:56:02 +09:00
Mike Hommey
5e0fc294de Bug 1300948 - Add thread identifier to LogAlloc output. r=njn 2016-09-08 07:55:03 +09:00
Kan-Ru Chen
a9b19d0584 Bug 1297276 - Rename mfbt/unused.h to mfbt/Unused.h for consistency. r=froydnj
The patch is generated from following command:

  rgrep -l unused.h|xargs sed -i -e s,mozilla/unused.h,mozilla/Unused.h,

MozReview-Commit-ID: AtLcWApZfES
2016-08-24 14:47:04 +08:00
Alexandre Lissy
b2834a3543 Bug 1284674 - Remove NUWA r=cyu
MozReview-Commit-ID: GyMRNzOBKw6
2016-08-02 14:54:00 +02:00
Tom Tromey
1b5a2bdb96 Bug 1286877 - do not set c-basic-offset for python-mode; r=gps
This removes the unnecessary setting of c-basic-offset from all
python-mode files.

This was automatically generated using

    perl -pi -e 's/; *c-basic-offset: *[0-9]+//'

... on the affected files.

The bulk of these files are moz.build files but there a few others as
well.

MozReview-Commit-ID: 2pPf3DEiZqx
2016-07-14 10:16:42 -06:00
Chris Peterson
1e35dbdf75 Bug 1272513 - Part 2: Remove redundant -Wshadow CXXFLAGS from moz.build files. r=glandium 2016-05-14 00:54:55 -07:00
Mike Hommey
328053961a Bug 1235738 - Move MOZ_DEBUG_DEFINES to build frontend. r=gps
MOZ_DEBUG_DEFINES are essentially defines used everywhere. So treat them as
feeding the initial value for DEFINES in each moz.build sandbox. This allows
the kind overrides that was done in the past by resetting MOZ_DEBUG_DEFINES
in Makefiles.
2015-12-31 07:27:23 +09:00
Mike Hommey
8e1b364f27 Bug 1209875 - Get rid of XULPPFLAGS. r=gps
The flags added in toolkit/locales/Makefile.in turn out not to be actually
used, so just remove that.

The remaining uses of XULPPFLAGS are to set debug flags depending on whether
MOZ_DEBUG is set or not. Just set a dedicated variable with the right value
from configure.
2015-10-01 07:30:48 +09:00
Chris Peterson
752223fd52 Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
Nicholas Nethercote
e8452d2670 Bug 1202965 (part 2) - Use MOZ_UNUSED in FdPrintf.c. r=glandium. 2015-09-09 17:01:32 -07:00
Mike Hommey
f35b22f2be Bug 1201792 - s/MOZ_JEMALLOC3/MOZ_JEMALLOC4/. r=njn 2015-09-04 15:15:47 +09:00