Commit Graph
757 Commits
Author SHA1 Message Date
Carsten "Tomcat" Book 1b0a24836c Backed out changeset 484c5137e19f (bug 1365194) to clean up spidermonkey 2017-05-17 11:44:17 +02:00
Carsten "Tomcat" Book 575493da50 Backed out changeset d8de424663b7 (bug 1365194) 2017-05-17 11:43:28 +02:00
Carsten "Tomcat" Book 1ff1e94ded Backed out changeset b56224bf370d (bug 1365194) 2017-05-17 11:43:26 +02:00
Carsten "Tomcat" Book d3855a6a5a Backed out changeset 4b9c2fb40653 (bug 1365194) 2017-05-17 11:43:24 +02:00
Carsten "Tomcat" Book 807507ec93 Backed out changeset 9711f5bbda3b (bug 1365194) 2017-05-17 11:43:22 +02:00
Carsten "Tomcat" Book 27621f4d7b Backed out changeset 4553b67c794f (bug 1365473) for breaking spidermonkey with illegal token on right side of.. 2017-05-17 11:31:32 +02:00
Mike Hommey 9620ef4fa9 Bug 1365473 - Rename jemalloc_types.h to mozjemalloc_types.h. r=njn 2017-05-12 21:52:25 +09:00
Mike Hommey 5d809465fe Bug 1365194 - Compile mozjemalloc as C++. r=njn
The source file is renamed too, because the build system doesn't handle
sources changing suffix very well (at least not without a clobber).

The _GNU_SOURCE define is removed because GCC/Clang set it by default in
C++ mode.
2017-05-12 21:52:25 +09:00
Mike Hommey bad60117ee Bug 1365194 - Remove parts of the hacks for memalign in mozjemalloc. r=njn
The hack dates back from the originally imported jemalloc code, which
couldn't assume it's built for Firefox. Now, we can assume that, which
means the code is always built with hidden visibility by default,
removing the need for the explicit hidden visibility.

Correspondingly, when building on Solaris with GCC, the default
visibility should also prevent the inlining, making the noinline
attribute redundant. And the Sun Studio path is useless since the
compiler is not supported anymore.
2017-05-16 20:01:55 +09:00
Mike Hommey 4578277dba Bug 1365194 - Make extern "C" part of MOZ_MEMORY_API and MOZ_JEMALLOC_API. r=njn
This avoids many additions of `extern "C"` in C++ code and will avoid
having to do the same to mozjemalloc once built as C++.
2017-05-16 18:46:02 +09:00
Mike Hommey de535a7e37 Bug 1365194 - Remove MOZ_JEMALLOC_API from _malloc_options and _malloc_message. r=njn
MOZ_JEMALLOC_API makes those symbols exported, but we're going to make
MOZ_JEMALLOC_API include `extern "C"`, which GCC warns about in this
case (can't use extern on a variable that is initialized).

While we could get around this in some way, there is not much use for
those variables being exported altogether: the only reason they are is
to allow an override when linking mozjemalloc into executables, but
doing that in Firefox requires patching the build system or passing some
specific LDFLAGS. People who really need to do that might as well apply
a patch.

They also allow run-time override through LD_PRELOAD, but one might as
well use the MALLOC_OPTIONS environment variable for _malloc_options.
As for _malloc_message, it doesn't seem very useful to override, and
probably noone ever overrode it at runtime.

Note, we may want to remove them in a followup.
2017-05-16 18:55:24 +09:00
Mike Hommey e24e3768b7 Bug 1365194 - Call moz_abort directly instead of using a macro to override abort. r=njn
Using -Dabort=moz_abort actually makes the build fail in some libstdc++
headers when building as C++.
2017-05-12 21:51:16 +09:00
Mike Hommey 8c1e323bac Bug 1365191 - Remove dead code hidden behind the never set NEEDS_PTHREAD_MMAP_UNALIGNED_TSD. r=njn 2017-05-11 18:05:14 +09:00
Mike Hommey 6545a8ee3f Bug 1365191 - Remove MALLOC_FILL from mozjemalloc. r=njn
It's always set.
2017-05-11 17:57:30 +09:00
Mike Hommey 17b79c1ed8 Bug 1365191 - Remove MALLOC_STATS from mozjemalloc. r=njn
It's always set.
2017-05-11 17:55:21 +09:00
Mike Hommey 4088f5e0c7 Bug 1365191 - Remove MALLOC_UTRACE from mozjemalloc. r=njn
It's always unset, and Firefox has the logalloc replace-malloc library
for something similar.
2017-05-11 17:47:02 +09:00
Mike Hommey a4dbdba306 Bug 1365191 - Remove MALLOC_VALIDATE in mozjemalloc. r=njn
It's always set.
2017-05-11 17:39:56 +09:00
Mike Hommey 625c9bdd18 Bug 1365191 - Remove !MOZ_MEMORY sections in mozjemalloc. r=njn
MOZ_MEMORY is always defined when building mozjemalloc. Due to the
origin of the code, this was all FreeBSD-specific code, and if we want
to add FreeBSD support, we will probably need to add some of it, but I'd
rather avoid keeping the difference between FreeBSD and other posix
systems if we can.
2017-05-11 17:34:54 +09:00
Mike Hommey 4c972d263f Bug 1365191 - Remove #if 0 sections in mozjemalloc. r=njn 2017-05-11 17:23:02 +09:00
Mike Hommey d46ee879e0 Bug 1364358 - Keep track of mozjemalloc thread-local arenas. r=erahm
jemalloc_stats, as well as pre/post-fork hooks are using the `arenas`
list along the `narenas` count to iterate over all arenas setup by
mozjemalloc. Up until previous commit, that was used for automatic
multiple arenas support, which is now removed.

But mozjemalloc still supports running with multiple arenas, in the form
of opted-in, per-thread arenas. After bug 1361258, those arenas weren't
tracked, and now that `arenas` only contains the default arena, we can
now fill it with those thread-local arenas.

Keeping the automatic multiple arenas support, which we don't use and
don't really plan to, would have meant using a separate list for them.
2017-05-12 21:21:11 +09:00
Mike Hommey 5cc58eef5f Bug 1364358 - Remove mozjemalloc support for automatic multiple arenas. r=erahm
As per explained 2 commits earlier, we remove the support for multiple
arenas. We however keep the `arenas` list and the `narenas` count to
use it them to track the opted-in per-thread arenas.
2017-05-11 17:21:36 +09:00
Mike Hommey 6a0d718530 Bug 1364358 - Remove mozjemalloc check for multithreading. r=erahm
mozjemalloc had an optimization that shortcuts using mutexes when the
program is single-threaded. But with code evolution, the check whether
the program had multiple threads running was meant to be true all the
time.

In order to simplify the code, we just remove those checks and dead code
they were hiding in some cases.
2017-05-11 17:18:59 +09:00
Mike Hommey c6e6b9bf9c Bug 1364358 - Remove mozjemalloc arena balancing. r=erahm
After bug 1361258, mozjemalloc uses a main arena for all allocations,
and specific threads can opt-in to use a different arena for that thread
only. Going forward, this is how we expect to support scaling across
different threads that require lots of concurrent allocations.

To simplify the mozjemalloc code, we'll remove the support for multiple
arenas.

This is the first step towards that, removing the support for arena
balancing. Everything behind the MALLOC_BALANCE macro has never been used
in practice.
2017-05-11 17:13:44 +09:00
Mike Hommey 8bfbefc1a9 Bug 1363992 - Remove jemalloc 4. r=njn 2017-05-11 13:23:07 +09:00
Mike Hommey 1f354dbf2a Bug 1363992 - Remove support for making jemalloc4 the default. r=njn 2017-05-11 13:16:00 +09:00
Mike Hommey 8d83a2663a Bug 1363992 - Remove support for system jemalloc. r=njn 2017-05-11 13:03:20 +09:00
Bobby Holley 9ed9c9693d Bug 1361258 - Backout 2214b3c57c9c (bug 1291356), disabling multiple jemalloc arenas. r=glandium 2017-05-13 08:21:05 +02:00
Mike Hommey 3bbb65d2e1 Bug 1361258 - Use Thread Local Storage in mozjemalloc on mac. r=erahm
NO_TLS used to be hardcoded on mac because up to 10.6, __thread was not
supported. Until recently, we still supported for 10.6, and it's not the
case anymore, so we could make mac builds use __thread.

Unfortunately, on OSX, __thread circles back calling malloc to allocate
storage on first access, so we have an infinite loop problem here.
Fortunately, pthread_keys don't have this property, so we can use that
instead. It doesn't appear to have significantly more overhead (and TLS
overhead is small anyways compared to the amount of work involved in
allocating memory with mozjemalloc).

At the same time, we uniformize the initialization sequence between
mozjemalloc and mozjemalloc+replace-malloc, such that we have less
occasions for surprises when riding the trains (replace-malloc being
nightly only), ensuring the zone registration happens at the end of
mozjemalloc's initialization.
2017-05-12 18:12:20 +09:00
Mike Hommey f087a5219f Bug 1361258 - Initial implementation for jemalloc_thread_local_arena. r=erahm
The function, when passed `true`, creates a new arena with no attachment
in the global list of arenas, and assigns it to the current thread.
When passed `false`, it restores the default arena.

Some details are left out because they don't matter yet, as the sole
initial use of the API is going to invoke the function when stylo rayon
threads start up, which happens exactly once per thread, and at thread
exit time, which happens at shutdown, if ever.

This simplifies things, and leaves those details to followup(s):
- Arenas can't simply be killed when the function is called with `false`
  again (or when the thread dies) because they may still contain valid
  allocations that could have been passed to other threads. Those arenas
  should be kept until they are empty.
- jemalloc_stats doesn't know about them and will under-report memory
  usage.
- pre/post fork hooks don't know about them and will not force-unlock
  their locks. In practice, until those arenas are used for something
  else than the style system, this can't lead to the dead-locks that
  these hooks help prevent because nothing should be touching pointers
  allocated through them after fork.
2017-05-12 18:12:15 +09:00
Julian Seward a9ca854b2f 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 053ccf427e 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
2017-04-21 15:54:05 -06:00
Tom Ritter 3ced994dc1 Bug 1332747 Change MOZ_ALWAYS_INLINE to MOZ_ALWAYS_INLINE_EVEN_DEBUG to fix MinGW Debug build r=froydnj
MozReview-Commit-ID: 7CkreJM1mHr
2017-04-11 12:53:58 -05:00
Alex Gaynor 03b3961515 Bug 1353847 - Updated the jemalloc mozilla README to reflect its new git url r=glandium
r=glandium

MozReview-Commit-ID: 2jqQoQAwtBW
2017-04-05 15:19:19 -04:00
Alex Gaynor 5a5e3e27c7 Bug 1353752 - Fixed building with jemalloc4 r=glandium
It was broken by 516551993d16.

r=glandium

MozReview-Commit-ID: BvejKjAPB84
2017-04-05 13:05:43 -04:00
Eric Rahm 762e849d10 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 d17705bdaa 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 b978499118 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
Bevis Tseng cbf352d0db Bug 1332491 - Delete SelectorCacheKey synchronously. r=bz
1. The current asynchronous behavior is pointless, because we still remove the
   hashtable entry synchronously, which deletes the value, and it's the value
   we're using.
2. Trying to asynchronously delete the value is difficult, and not currently
   needed because we can't get a memory-pressure notification while we're using
   the value, and hence can't expire it from the expiration tracker.
   Note: we can't get this memory-pressure notification because the stage 2 of
   mozalloc_handle_oom() to reclaim memory when OOM is not implemented yet.
2017-03-13 14:37:19 +08:00
Joel Maher 1412f4ce56 Bug 1344471 - add BUG_COMPONENT to memory/* files. r=glandium
MozReview-Commit-ID: FiUCPht3MEJ
2017-03-08 11:17:11 -05:00
Ryan VanderMeulen 5ded2f9a25 Bug 1343432 - Update jemalloc 4 to version 4.5.0. r=glandium 2017-03-01 21:06:24 -05:00
Iris Hsiao 37f5caf99a Backed out changeset 24bea8bde57d (bug 1343432) for build bustage 2017-03-02 11:23:28 +08:00
Ryan VanderMeulen 25058b30c8 Bug 1343432 - Update jemalloc 4 to version 4.5.0. r=glandium 2017-03-01 21:06:24 -05:00
Eric Rahm b90c90aec2 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 9b18594311 Bug 419470: Re-enable PGO for Linux mozjemalloc. r=glandium
It only took nine years.

MozReview-Commit-ID: 2zsCBMTJ6O1
2017-02-22 09:46:06 +13:00
Emanuel Hoogeveen 518860841b Bug 1338574 - Part 8: Use MOZ_ASSERT and MOZ_CRASH_UNSAFE_OOL in mozjemalloc. r=glandium 2017-02-21 18:02:07 +01: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
Wes Kocher b91739bde1 Merge inbound to m-c a=merge
MozReview-Commit-ID: IKI0zVtF1n9
2017-02-15 16:18:13 -08:00
Emanuel Hoogeveen 8738d9d6d4 Bug 1339441 - Take the arena lock earlier in arena_dalloc(). r=glandium 2017-02-15 09:48:00 -05: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
Benjamin Smedberg 3a243797b4 Bug 1333826 - Remove SDK_FILES, SDK_LIBRARY, and related is_sdk support in the build goop, r=mshal
MozReview-Commit-ID: 52vPyDXdFte
2017-01-30 11:24:10 -05:00