Commit Graph

718 Commits

Author SHA1 Message Date
Ryan VanderMeulen
90e0fe11c9 Bug 1343432 - Update jemalloc 4 to version 4.5.0. r=glandium 2017-03-01 21:06:24 -05:00
Iris Hsiao
73bf12810d Backed out changeset 24bea8bde57d (bug 1343432) for build bustage 2017-03-02 11:23:28 +08:00
Ryan VanderMeulen
5d6e7cab50 Bug 1343432 - Update jemalloc 4 to version 4.5.0. r=glandium
--HG--
extra : rebase_source : 0113418a6ba808bf2b3a60bf6e98740791bf02e4
2017-03-01 21:06:24 -05: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
David Major
bb5fe68fae Bug 419470: Re-enable PGO for Linux mozjemalloc. r=glandium
It only took nine years.

MozReview-Commit-ID: 2zsCBMTJ6O1

--HG--
extra : rebase_source : e3be1bd1c930d32d3c7a9e2d707ed3fe6bc0936f
2017-02-22 09:46:06 +13:00
Emanuel Hoogeveen
51fc28feca Bug 1338574 - Part 8: Use MOZ_ASSERT and MOZ_CRASH_UNSAFE_OOL in mozjemalloc. r=glandium
--HG--
extra : rebase_source : 73f61842eb44bd0bfe7d3eca9267cfa10f771295
2017-02-21 18:02:07 +01: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
Wes Kocher
017c515285 Merge inbound to m-c a=merge
MozReview-Commit-ID: IKI0zVtF1n9
2017-02-15 16:18:13 -08:00
Emanuel Hoogeveen
00c7d04549 Bug 1339441 - Take the arena lock earlier in arena_dalloc(). r=glandium
--HG--
extra : rebase_source : 95e8f744a9f77381270fd8f8942765b144b844a2
2017-02-15 09:48:00 -05: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
Benjamin Smedberg
ca77995f5d Bug 1333826 - Remove SDK_FILES, SDK_LIBRARY, and related is_sdk support in the build goop, r=mshal
MozReview-Commit-ID: 52vPyDXdFte

--HG--
extra : rebase_source : c3217730bb70eb7319152dd07536b12f49d6a597
2017-01-30 11:24:10 -05:00
Dimitry Andric
8b0557b033 Bug 1329520 - Fix "memory/mozalloc/throw_gcc.h:35:1: note: declaration missing '[[noreturn]]' (libc++ 4.0)" r=nfroyd 2017-01-27 13:55:00 +01:00
Mike Hommey
c9370d609b Bug 1332508 - Reinitialize allocator mutexes in fork() child processes. r=njn
Adapted from
4e2e3dd9cf
and
d9f7b2a430

As per the latter commit, it would seem unlocking, in fork() child
processes, mutexes that were locked in the parent process is not really
well supported on OSX 10.12. The addition of the zone_reinit_lock
function in 10.12 supports this idea.

--HG--
extra : rebase_source : b3b58558cc195d63200078085c7e9b6c9b8d83ff
2017-01-20 10:06:41 +09:00
Mike Hommey
dbc87ab49d Bug 1286613 - Update jemalloc 4 to c6943ac. r=njn
This picks the same changes as the ones we just did to
memory/build/zone.c, plus a oneliner for sparc64.

--HG--
extra : rebase_source : ca917461472e8188fbfc6e2a971b228b68014e38
2017-01-18 15:47:53 +09:00
Mike Hommey
4e8f02fe22 Bug 1286613 - Add dummy implementations for most remaining OSX zone allocator functions. r=njn
Some system libraries are using malloc_default_zone() and then using
some of the malloc_zone_* API. Under normal conditions, those functions
check the malloc_zone_t/malloc_introspection_t struct for the values
that are allowed to be NULL, so that a NULL deref doesn't happen.

As of OSX 10.12, malloc_default_zone() doesn't return the actual default
zone anymore, but returns a fake, wrapper zone. The wrapper zone defines
all the possible functions in the malloc_zone_t/malloc_introspection_t
struct (almost), and calls the function from the registered default zone
(jemalloc in our case) on its own. Without checking whether the pointers
are NULL.

This means that a system library that calls e.g.
malloc_zone_batch_malloc(malloc_default_zone(), ...) ends up trying to
call jemalloc_zone.batch_malloc, which is NULL, and crash follows.

So as of OSX 10.12, the default zone is required to have all the
functions available (really, the same as the wrapper zone), even if they
do nothing.

This is arguably a bug in libsystem_malloc in OSX 10.12, but jemalloc
still needs to work in that case.

[Adapted from
c6943acb3c]

--HG--
extra : rebase_source : 7d7a5b47fa18f56183e99c3655aee003c9be161e
2017-01-18 14:35:11 +09:00
Mike Hommey
dae510ade1 Bug 1286613 - Don't rely on OSX SDK malloc/malloc.h for malloc_zone struct definitions. r=njn
The SDK jemalloc is built against might be not be the latest for various
reasons, but the resulting binary ought to work on newer versions of
OSX.

In order to ensure this, we need the fullest definitions possible, so
copy what we need from the latest version of malloc/malloc.h available
on opensource.apple.com.

[Adapted from
c68bb41793]

--HG--
extra : rebase_source : ab19c478b568ea24095a3be62c39fb81efc1920a
2017-01-18 13:50:35 +09:00
Mike Hommey
e52769e834 Bug 1286613 - Use the same zone allocator implementation as replace-malloc for mozjemalloc. r=njn
We have been using a different zone allocator between mozjemalloc and
replace-malloc for a long time. Jemalloc 4 uses the same as
replace-malloc, albeit as part of the jemalloc upstream code base.

We've been bitten many times in the past with Apple changes breaking the
zone allocator, and each time we've had to make changes to the three
instances, although two of them are similar and the changes there are
straightforward.

It also turns out that the way the mozjemalloc zone allocator is set up,
when a new version of OSX appears with a new version of the system zone
allocator, Firefox ends up using the system allocator, because the zone
allocator version is not supported.

So, we use the same zone allocator for both replace-malloc and
mozjemalloc, making everything on par with jemalloc 4.

--HG--
extra : rebase_source : 9c0e245b5f82bb71294370d607e690c05cc89fbc
2017-01-18 11:45:45 +09:00
Mike Hommey
d293cc01a1 Bug 1286613 - Move replace-malloc zone allocator to a separate file. r=njn
The intent here is to reuse the zone allocator for mozjemalloc, to avoid
all the shortcomings of mozjemalloc using a different one. This change
only moves the replace-malloc zone allocator out of replace-malloc.c, to
make changes for mozjemalloc integration clearer.

--HG--
rename : memory/build/replace_malloc.c => memory/build/zone.c
extra : rebase_source : 8b98efaa4a88862f2967c855b511e92beb9c4031
2017-01-18 11:39:29 +09:00
Mike Hommey
50dd84a5d8 Bug 1286613 - Properly call mozjemalloc pre/post fork hooks on OSX when replace-malloc is enabled. r=njn
Somehow, we never called those hooks when replace-malloc is enabled. I'd
expect this to cause random deadlocks when forking, and I'm surprised
this hasn't surfaced. Maybe it actually causes some intermittent oranges
on automation, who knows.

This also brings consistency with what is done for jemalloc 4, and with
the mozjemalloc implementation, too, that we're going to replace with
this one in a subsequent changeset.

--HG--
extra : rebase_source : 059567d17f928098db8367e9081b631ced351110
2017-01-19 09:37:22 +09:00
John Paul Adrian Glaubitz
4b76f57494 Bug 1275204 - mozjemalloc: Use the JS arm64 allocator on Linux/sparc64. r=glandium 2017-01-11 16:09:39 +09:00
John Paul Adrian Glaubitz
dbf939ff1d Bug 1275204 - mozjemalloc: Use better pre-processor defines for sparc64. r=glandium 2017-01-11 16:05:53 +09:00
Ryan VanderMeulen
ab68dae81c Bug 1200951 - Use the same poison patterns for jemalloc4 as mozjemalloc. r=glandium
--HG--
extra : rebase_source : c44d6020934f16e53ce1c3553c5f952981bceb03
2017-01-10 22:50:36 -05:00
Ryan VanderMeulen
7d537bf11a Bug 1322027 - Update jemalloc 4 to version 4.4.0. r=glandium
--HG--
extra : rebase_source : acad2186ad3ace467a626fcf38659aaf6708c96b
2017-01-10 22:50:36 -05:00
Chris Peterson
b9fd4f1b11 Bug 1142403 - Part 3: jemalloc4 no longer requires ctl.c to be built in non-unified mode in debug builds. r=glandium
--HG--
extra : rebase_source : 9c1e00514be306552722ebd855d364b9b98b5c87
2016-12-22 18:54:59 -08:00
Mike Hommey
bbde532853 Bug 1142403 - Part 1: Don't build jemalloc4 with unified sources when built with --enable-debug. r=mshal
When built with --enable-debug, jemalloc4 makes headers define functions that
are normally inlined, and that prevents unified sources from working.

--HG--
extra : rebase_source : 9490a0a8312e9be18e639384e3450a9c924e3daf
extra : source : a67867200ec31a040bb6bf8320bde20beb34aa3e
2015-08-12 16:04:53 +09: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
Mike Hommey
97ae022e70 Bug 1311039 - Properly detect the default malloc zone on OSX 10.12. r=njn
--HG--
extra : rebase_source : e625875064e051fa931cab5827debe9fd02d91cf
2016-11-03 10:02:06 +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
Eric Rahm
2faeed6d55 Bug 1313485 - Convert XPCOM test TestJemalloc to a gtest. r=njn
MozReview-Commit-ID: 5yzn8o33Ne5

--HG--
rename : xpcom/tests/TestJemalloc.cpp => memory/gtest/TestJemalloc.cpp
2016-11-09 10:24:22 -08:00
Ryan VanderMeulen
3445ad743b Bug 1277704 - Update jemalloc 4 to version 4.3.1. r=glandium
--HG--
extra : rebase_source : d8c50b1012085fad8d7bd940abb41d51423bc12c
2016-07-12 10:37:04 -04:00
Emanuel Hoogeveen
e0a81d7503 Bug 1309573 - Part 2: Define MOZ_HAS_MOZGLUE in various places so that the crash reason gets used. r=glandium
--HG--
extra : rebase_source : d55e8dd75469759f333366bdf9662178ff0a2474
2016-11-08 03:53:00 -05:00
Sebastian Hengst
193fc03fc6 Backed out changeset 1b545e55e42a (bug 1313485) for bustage. r=backout
--HG--
rename : memory/gtest/TestJemalloc.cpp => xpcom/tests/TestJemalloc.cpp
2016-11-07 23:46:09 +01:00
Eric Rahm
52ba7f5179 Bug 1313485 - Convert XPCOM test TestJemalloc to a gtest. r=njn
MozReview-Commit-ID: 5yzn8o33Ne5

--HG--
rename : xpcom/tests/TestJemalloc.cpp => memory/gtest/TestJemalloc.cpp
2016-11-07 14:26:25 -08:00
Mike Hommey
97f635df6b 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
7e7b4f9fe6 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
39fe86c4ed Bug 1300948 - Add thread identifier to LogAlloc output. r=njn 2016-09-08 07:55:03 +09:00
Cameron McCormack
072d6a1fbe Bug 1291356 - Enable multiple jemalloc arenas for MOZ_STYLO builds. r=me
--HG--
extra : rebase_source : eaaaf6fd3aad8a99c7032ce55a1d351f2bf80af1
2016-08-26 20:21:48 +09:00
Wes Kocher
50954c6f31 Merge m-c to autoland, a=merge 2016-08-25 17:15:05 -07:00
Emanuel Hoogeveen
8210833803 Bug 1294732 - Back out all of bug 1271165 as it has served its purpose. r=glandium 2016-08-23 08:45:00 -04:00
Andrew McCreight
5772f60634 Bug 1295695 - Add maybe_pod_* methods to InfallibleAllocPolicy. r=glandium
Bug 1207519 added maybe_pod_* methods to the allocation policy
classes, but did not add them to InfallibleAllocPolicy.

I think the idea of these methods is that the callers are explicitly
opting into fallible behavior, so they will deal with any errors that
occur. For instance, in js::HashTable, this is used to try to shrink
the hash table when there are a lot of unused entries. If the shrink
fails, it just continues to use the existing block of memory.

However, having fallible methods in a supposedly infallible class is
weird, so for now, just use the infallible version.

MozReview-Commit-ID: 97D66Z4oLfl

--HG--
extra : rebase_source : 9a3e0b50a5602a8e4772da88c16e1715c25da7df
2016-08-16 11:09:05 -07:00
Ryan VanderMeulen
69113163cf Merge m-c to inbound. a=merge 2016-08-24 09:09:05 -04:00
Andrew McCreight
faa1eb2316 Bug 1295688 - InfallibleAllocPolicy should crash on overflow. r=glandium
Code that uses InfallibleAllocPolicy presumably wants for operations
to always succeed. However, Vector and HashTable can end up detecting
that growing the data structure will fail due to integer overflow, and
then will call reportAllocOverflow() and fail. I think these cases
should crash.

In addition, pod_malloc and pod_realloc should crash rather than
returning NULL when they detect overflow.

This calls mozalloc_abort rather than MOZ_CRASH directly to avoid
circular #includes, because Assertions.h includes nsTraceRefcnt.h
which includes nscore.h which includes mozalloc.h.

MozReview-Commit-ID: 1g99BXLceQI

--HG--
extra : rebase_source : 927d842588c1f85a50a7a1c50a5546d5f688555f
2016-08-16 10:56:14 -07:00
Kan-Ru Chen
b6d880aca1 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


--HG--
rename : mfbt/unused.h => mfbt/Unused.h
2016-08-24 14:47:04 +08:00
Emanuel Hoogeveen
581ecef4dd Bug 1271165 - Part 6: Change the new functions to MFBT_API to export them on OSX. r=jandem
--HG--
extra : rebase_source : cc3d6cd7cec9c822904364ace811d2c0dff98eff
2016-08-16 07:12:00 -04:00
Emanuel Hoogeveen
f7bdbc26ad Bug 1271165 - Part 4: Enable the new functionality in mozjemalloc. r=ehoogeveen 2016-08-12 07:38:00 -04:00
Emanuel Hoogeveen
57b1d1e8f2 Bug 1271165 - Part 2: Hook the new functions up and provide dummy implementations where needed. r=ehoogeveen 2016-08-12 07:37:00 -04:00
Emanuel Hoogeveen
506ca1034e Bug 1271165 - Part 1: Add protected allocation functions and supporting infrastructure to mozjemalloc. r=ehoogeveen 2016-08-12 07:36:00 -04:00
Emanuel Hoogeveen
54e158268e Bug 1271165 - Part 0: Strip trailing blanks from mozjemalloc. r=ehoogeveen 2016-08-12 07:36:00 -04:00
Alexandre Lissy
0af5b943b6 Bug 1284674 - Remove NUWA r=cyu
MozReview-Commit-ID: GyMRNzOBKw6

--HG--
extra : rebase_source : 293af1cd55f2035ce6a99f4ebf144059c32a2b8f
2016-08-02 14:54:00 +02:00
Chris Peterson
6229606616 Bug 1290645 - Remove VS2013 workarounds in memory/. r=glandium 2016-07-28 11:46:30 -07:00