Commit Graph

853 Commits

Author SHA1 Message Date
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
Tom Tromey
5538d692d3 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

--HG--
extra : rebase_source : 0a7dcac80b924174a2c429b093791148ea6ac204
2016-07-14 10:16:42 -06:00
Mike Hommey
63e7e7ede4 Bug 1280578 - Wrap HeapAlloc, HeapFree and HeapReAlloc on Windows. r=njn
The Win32 has non-malloc based heap allocation functions. They are not
widely used in the Gecko code base, but there are a few places that do
use them. They could be replaced with uses of malloc/free/realloc or
new/delete, but there is now an entirely separate problem that
requires wrapping those functions: the Rust static libraries are using
those functions to allocate memory.
2016-07-20 14:04:40 +09:00
Nicholas Nethercote
6f4e7b36f5 Bug 1282185 (part 2) - Fix an assertion failure in DMD. r=erahm.
--HG--
extra : rebase_source : cb2ae2a5a6fdc84bbcaba64759b0dbce1e161249
2016-07-13 19:32:27 +10:00
Nicholas Nethercote
dcf407f2a8 Bug 1282185 (part 1) - Remove a bogus assertion in DMD. r=erahm.
Since bug 1253512 landed, it's possible for DeadBlocks to lack an allocation
stack.

--HG--
extra : rebase_source : 0efc60192ed0992d2f68838d95586cd888765586
2016-07-13 18:10:56 +10:00
Mike Hommey
16529670ac Bug 1284677 - Change how the default OSX malloc zone is found. r=njn
--HG--
extra : rebase_source : b5ea2bfb37047fa9f8d4d833186694407c73adda
2016-07-08 14:48:16 +09:00
Bill McCloskey
308608ab39 Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) 2016-05-27 09:57:40 -07:00
Mike Hommey
8855262939 Bug 1269171 - Change how mozalloc.h is hooked in STL wrappers. r=froydnj
Since the introduction of the STL wrappers, they have included
mozalloc.h, and multiple times, we've hit header reentrancy problems,
and worked around them as best as we could.

Taking a step back, all mozalloc.h does is:
- declare moz_* allocator functions.
- define inline implementations of various operator new/delete variants.

The first only requires the functions to be declared before they are used,
so mozalloc.h only needs to be included before anything that would use
those functions.

The second doesn't actually require a specific order, as long as the
declaration for those functions comes before their use, and they are
either declared in <new> or implicitly by the C++ compiler.

So all in all, it doesn't matter that mozalloc.h is included before the
wrapped STL headers. What matters is that it's included when STL headers
are included. So arrange things such that mozalloc.h is included after
the first wrapped STL header is fully preprocessed (and all its includes
have been included).
2016-05-22 08:32:40 +09:00
Chris Peterson
8a9e2d2bd4 Bug 1272513 - Part 2: Remove redundant -Wshadow CXXFLAGS from moz.build files. r=glandium 2016-05-14 00:54:55 -07:00
Chris Peterson
353ee65255 Bug 1272513 - Part 1: Suppress -Wshadow warnings-as-errors in some directories. r=glandium 2016-05-11 00:00:01 -07:00
Jan Beich
6d9051edd6 Bug 1259537 - Unbreak libc++ build after bug 1245076. r=glandium
MozReview-Commit-ID: 31otXvuDu4A

--HG--
extra : rebase_source : 048a81a540154b672a9249482124d396336acbc4
2016-05-01 09:32:10 +00:00
Ryan VanderMeulen
662ef75681 Bug 1269959 - Update jemalloc 4 to version 4.1.1. r=glandium
--HG--
extra : rebase_source : cf6f490bd2e366cff642d97927c8a54ef4d762a1
2016-05-03 20:26:00 -04:00
Nicholas Nethercote
2511b2c327 Bug 1267550 (part 2) - Rename MOZ_WARN_UNUSED_RESULT as MOZ_MUST_USE. r=froydnj.
It's an annotation that is used a lot, and should be used even more, so a
shorter name is better.

MozReview-Commit-ID: 1VS4Dney4WX

--HG--
extra : rebase_source : b26919c1b0fcb32e5339adeef5be5becae6032cf
2016-04-27 14:16:50 +10:00
Makoto Kato
234456a100 Bug 1091515 - Don't set 64KB page size on aarch64. r=glandium
Linux/aarch64 supports vairous page size configuration.

(From https://www.kernel.org/doc/Documentation/arm64/memory.txt)
- 4KB + 3 levels
- 4KB + 4 levels
- 64KB + 2 leves

So we shouldn't set fixed 64KB page size on aarch64.


MozReview-Commit-ID: 8IdwBMUW4me

--HG--
extra : rebase_source : 2f3d8de3ea118313cb6dc5f48b7532d9b051c1e6
2016-04-05 18:54:42 +09:00
Nicholas Nethercote
b1378bc5e8 Bug 1260329 - Properly escape the frameTable when running |dmd.py --clamp-contents|. r=mccr8.
--HG--
extra : rebase_source : 7a55328abb0a79cfa6de21734ee3d440b7625f79
2016-03-29 13:34:57 +11:00
Eric Rahm
c2edbab476 Bug 1181142 - Part 1: Make the minimum allocation size word sized on all platforms. r=glandium
Bug 691003 made the minimum allocation size word sized for Linux and OS X, we
now need to do a similar change on Windows as well. For Windows the requirement
is 8-bytes on 32-bit and 16-bytes on 64-bit.
2015-07-07 17:36:31 -07:00
Nicholas Nethercote
43969ea737 Bug 1181142 - Part 0: Update DMD tests to handle a minimum alloc size of 16 on Win64. r=erahm. 2016-03-29 16:31:21 +11:00
Nicholas Nethercote
eb9d46b90f Bug 1253512 (part 2) - Aggregate live blocks. r=erahm.
Due to the change in part 1, DMD now prints an entry for every live block,
which increases the output file size significantly in the default case. However,
a lot of those entries are identical and so can be aggregated via the existing
"num" property.

This patch does that, reducing output size by more than half.

--HG--
extra : rebase_source : 6a3709d068f2fb9bbfe3344d7406f05af896380b
2016-03-29 10:41:06 +11:00
Nicholas Nethercote
0f418f3874 Bug 1253512 (part 1) - Overhaul DMD's "sampling". r=erahm.
DMD currently uses a very hacky form of "sampling" by default to avoid
recording stack traces for all blocks. This makes DMD run faster than when it
records all stack traces.

This patch changes the sampling method used; in fact, it avoids "sampling" at
all. The existence of all heap blocks is now recorded exactly, but by default
we only record an allocation stack for each heap block if a Bernoulli trial
succeeds. This choice works well because getting the stack trace is ~100x
slower than recording the block's existence.

Overall, this approach is simpler and it also gives better output -- the choice
of which blocks to record allocation stacks for is mathematically sound, no
stack trace gets blamed for allocations it didn't do, and block counts and
sizes are now always exact.

Other specific things changed.

- All notion of sampling is removed from the various data structures.

- The --sample-below option is removed in favour of --stacks={partial,full}.

- The format of the JSON output file has changed.

- The names of various test files have changed to reflect concept changes.

--HG--
rename : memory/replace/dmd/test/full-empty-cumulative-expected.txt => memory/replace/dmd/test/complete-empty-cumulative-expected.txt
rename : memory/replace/dmd/test/full-empty-dark-matter-expected.txt => memory/replace/dmd/test/complete-empty-dark-matter-expected.txt
rename : memory/replace/dmd/test/full-empty-live-expected.txt => memory/replace/dmd/test/complete-empty-live-expected.txt
rename : memory/replace/dmd/test/full-unsampled1-dark-matter-expected.txt => memory/replace/dmd/test/complete-full1-dark-matter-expected.txt
rename : memory/replace/dmd/test/full-unsampled1-live-expected.txt => memory/replace/dmd/test/complete-full1-live-expected.txt
rename : memory/replace/dmd/test/full-unsampled2-cumulative-expected.txt => memory/replace/dmd/test/complete-full2-cumulative-expected.txt
rename : memory/replace/dmd/test/full-unsampled2-dark-matter-expected.txt => memory/replace/dmd/test/complete-full2-dark-matter-expected.txt
rename : memory/replace/dmd/test/full-sampled-live-expected.txt => memory/replace/dmd/test/complete-partial-live-expected.txt
extra : rebase_source : 47d287405dc5e9075f08addaba49e879c2c6e23f
2016-02-24 14:42:22 +11:00
Sebastian Hengst
554c274197 Backed out changeset 4593c32d5b81 (bug 1181142) for making XPCshell test_dmd.js fail on Windows 8 x64 debug. r=backout 2016-03-25 21:53:30 +01:00
Eric Rahm
9386c16326 Bug 1181142 - Part 1: Make the minimum allocation size word sized on all platforms. r=glandium
Bug 691003 made the minimum allocation size word sized for Linux and OS X, we
now need to do a similar change on Windows as well. For Windows the requirement
is 8-bytes on 32-bit and 16-bytes on 64-bit.
2015-07-07 17:36:31 -07:00
Nicholas Nethercote
5752d3b3e6 Bug 1258257 - Reduce mozjemalloc page cache size from 4 MiB to 1 MiB. r=glandium.
This reduces memory usage by up to 3 MiB per process.

MozReview-Commit-ID: Gfs9PIJM4br

--HG--
extra : rebase_source : 69ac5acf7f7f0c802a047f5bf72838e5c4d1f123
2016-03-24 16:38:45 +11:00
Ted Mielczarek
68bd5e8c4d bug 1244743 - Replace MOZ_NATIVE_X with MOZ_SYSTEM_X. r=gps
MozReview-Commit-ID: 9ip3qeAXFEe

--HG--
extra : commitid : H6aEkHprVyX
extra : rebase_source : e20d5f4b297caf66711c72cd55dd76f7f9ef9d9c
extra : histedit_source : 47545e0ea61eb66f16545f70e6d3792a389bedb1
2016-02-01 10:49:34 -05:00
Mike Hommey
8170c2d9bc Bug 1254850 - Update jemalloc 4 to version 4.1.0. r=njn 2016-03-11 09:38:28 +09:00
Ms2ger
d1f112a81b Bug 1254948 - Remove makefiles used to transition from jemalloc_config.c to jemalloc_config.cpp; r=glandium 2016-03-10 15:53:58 +01:00
Jonathan Watt
a9c7d25928 Bug 1253094, part 10 - Stop using DebugOnly for class/struct members in memory/. r=njn
MozReview-Commit-ID: LLSCgDES38Q
2016-02-26 15:52:08 +00:00
Nicholas Nethercote
460cabb8f7 Bug 1253526 (part 2) - Gut DMD's usage message. r=erahm
It's rare anyone would see it, and it just duplicates the info present in |mach
run|.

--HG--
extra : rebase_source : fbb1716616ca1ff007af4202757586627c8612b4
2016-03-04 17:12:37 +11:00
Nicholas Nethercote
ebc23cf4dc Bug 1253526 (part 1) - Remove DMD's --max-frames option. r=erahm.
Nobody uses it.

--HG--
extra : rebase_source : 6fe2af5f2b7ec19fad8f8cd49871a63599d7ebba
2016-03-04 17:02:20 +11:00
Lee Salzman
5a00a76a1f Bug 1248416 - add symbols for bad_function_call exception for C++ runtimes. r=nfroyd 2016-02-24 20:00:10 -05:00
Nicholas Nethercote
160743c7c2 Bug 1144842 (part 2) - Make --enable-dmd imply --enable-profiling. r=glandium.
This requires moving the --enable-dmd code earlier, before MOZ_PROFILING starts
being used.

--HG--
extra : rebase_source : acfdc6c4c82436c0a1834e11ddc567e37318da60
2016-01-21 16:58:50 -08:00
Andrea Marchesini
caa2f9b456 Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug 2016-01-12 18:16:59 +00:00
Carsten "Tomcat" Book
3589aeeb8a Backed out changeset d6b0ffe1a7b3 (bug 1231378) 2016-01-12 15:48:54 +01:00
Andrea Marchesini
2609a149da Bug 1231378 - part 4 - Fix uninitialized members of classes in netwerk/widget/storage/uriloader/memory/tools, r=smaug 2016-01-12 13:57:37 +00:00
Nicholas Nethercote
a9f31c44eb Bug 1232219 (part 4) - Enable -Wunused for C code, except where it's too annoying. r=glandium.
--HG--
extra : rebase_source : febc9aac7ec5e3699742e728065c370dcee4f0f3
2015-12-16 22:59:42 -08:00
Nicholas Nethercote
57bef6b196 Bug 1232219 (part 3) - Fix remaining -Wunused warnings. r=glandium.
--HG--
extra : rebase_source : 357474b4c7729b78a3030dfefd720aad4e1b2576
2015-12-16 22:57:51 -08:00
Mike Hommey
e0c501a1c1 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
Jon Coppeard
498b421261 Bug 1232672 - Use MOZ_WARN_UNUSED_RESULT to make hash table clients check for failure r=luke r=billm r=njn 2015-12-22 13:29:43 +00:00
Nathan Froyd
1ef4f45198 Bug 1186934 - update jemalloc to upstream HEAD; r=glandium 2015-12-14 10:05:32 -05:00
Jan Beich
16a744dd9f Bug 1229395 - Part 2 - Rely on MALLOC_H to provide function prototypes for MOZ_NATIVE_JEMALLOC. r=glandium 2015-12-01 16:54:44 +00:00
Jan Beich
93cec6dc70 Bug 1229395 - Part 1 - Unbreak MOZ_NATIVE_JEMALLOC after bug 1141079. r=glandium 2015-12-01 16:39:33 +00:00
Chris Peterson
18028bbae1 Bug 1226907 - Part 2: Fix warnings in mozjemalloc and remove ALLOW_COMPILER_WARNINGS. r=glandium 2015-11-15 13:21:56 -08:00
Chris Peterson
6cdcbe459d Bug 1226907 - Part 1: Check _write and strerror_r return values in mozjemalloc. r=njn 2015-11-27 13:24:56 -08:00
Eric Rahm
ce27e9a516 Bug 1160272 - DMD build should include |mfbt/Poison.cpp|. r=glandium
--HG--
extra : rebase_source : 01dbcc2f41aa8325a9e0859e7848ce673457d4a7
2015-04-30 15:13:05 -07:00
Mike Hommey
762aba02cd Bug 1221453 - Use ObjDirPaths for GENERATED_INCLUDES and merge with LOCAL_INCLUDES. r=gps 2015-11-06 09:59:21 +09:00
Nicholas Nethercote
5b34a25af2 Bug 1216020 - Comment all ALLOW_COMPILER_WARNINGS lines. r=glandium.
DONTBUILD because it only changes comments.

This will hopefully prevent confusion like that in bug 1215903.

--HG--
extra : rebase_source : f0a601d77b5f42b4fbe090693234f934e3becc42
2015-10-19 18:05:20 -07:00
Nathan Froyd
01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd
583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Carsten "Tomcat" Book
08997000eb Backed out 2 changesets (bug 1202902) to recking bug 1202902 to be able to reopen inbound on a CLOSED TREE
Backed out changeset 647025383676 (bug 1202902)
Backed out changeset d70c7fe532c6 (bug 1202902)
2015-10-07 14:03:21 +02:00
Carsten "Tomcat" Book
e7ef778c9d Backed out 1 changesets (bug 1202902) for causing merge conflicts to mozilla-central
Backed out changeset cfc1820361f5 (bug 1202902)

--HG--
extra : rebase_source : 5d3db72337754bc7ab0ed0c30b2896100411ff92
2015-10-07 12:13:45 +02:00
Shu-yu Guo
d06b6030f6 Bug 1202902 - Scripted fix the world. 2015-10-06 14:00:31 -07:00
Mike Hommey
9f2c4e94ba 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
Jon Coppeard
204777d13d Bug 1207519 - Prevent HashTable shrink from ignoring allocation failures that may have been reported r=Waldo 2015-09-30 11:34:49 +01:00
Jon Coppeard
0b41e069f3 Bug 1200642 - Add checkSimulatedOOM() to AllocPolicy r=Waldo 2015-09-30 11:34:44 +01:00
Nathan Froyd
5761751aa3 Bug 1207245 - part 1 - move RefCounted<T> to its own file
Various bits depend on RefPtr.h to provide RefCounted<T> and RefPtr<T>.
It will be easier to manage an automatic conversion from RefPtr<T> to
nsRefPtr<T> if we split out the dependency on RefCounted<T> first.
2015-09-22 21:27:34 -04:00
Chris Peterson
71920a9550 Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
Mike Hommey
538706caba Bug 1203840 - Trigger dirty pages purge after CC. r=njn,r=smaug,r=mccr8
Jemalloc 4 purges dirty pages regularly during free() when the ratio of dirty
pages compared to active pages is higher than 1 << lg_dirty_mult.  We set
lg_dirty_mult in jemalloc_config to limit RSS usage, but it also has an impact
on performance.

So instead of enforcing a high ratio to force more pages being purged, we keep
jemalloc's default ratio of 8, and force a regular purge of all dirty pages,
after cycle collection.

Keeping jemalloc's default ratio avoids cycle-collection-triggered purge to
have to go through really all dirty pages when there are a lot, in which case
the normal jemalloc purge during free() will already have kicked in. It also
takes care of everything that doesn't run the cycle collector still having
a level of purge, like plugins in the plugin-container.

At the same time, since jemalloc_purge_freed_pages does nothing with jemalloc 4,
repurpose the MEMORY_FREE_PURGED_PAGES_MS telemetry probe to track the time
spent in this cycle-collector-triggered purge.
2015-09-20 17:43:43 +09:00
Shu-yu Guo
64db2267cf Bug 1202902 - Mass replace toplevel 'let' with 'var' in preparation for global lexical scope. (rs=jorendorff) 2015-09-15 11:19:45 -07:00
David Major
cc3cd34e27 Bug 1174250: Allow the CommitHook to fail without crashing. r=glandium 2015-09-15 13:53:38 -04:00
Nicholas Nethercote
cfcd8fbc5f Bug 1203476 - Fix an Android-only warning in mozalloc_abort.cpp. r=glandium.
And remove the corresponding and now-unnecessary ALLOW_COMPILER_WARNINGS=True.
2015-09-10 16:20:19 -07:00
Nicholas Nethercote
26157f37df Bug 1202965 (part 2) - Use MOZ_UNUSED in FdPrintf.c. r=glandium. 2015-09-09 17:01:32 -07:00
Nigel Babu
eb13864a70 Backed out changeset a67867200ec3 (bug 1142403) for Linuxx64 M-e10s(2) bustage. 2015-09-08 13:14:05 +05:30
Mike Hommey
1e7025fdf4 Bug 1142403 - Don't build jemalloc3 with unified sources when built with --enable-debug. r=mshal
When built with --enable-debug, jemalloc3 makes headers define functions that
are normally inlined, and that prevents unified sources from working.
2015-09-08 13:13:25 +09:00
Mike Hommey
0cf8973ede Bug 1202523 - Use the default chunk size with jemalloc 4. r=njn 2015-09-08 13:10:22 +09:00
Mike Hommey
0efccdc82c Bug 1201792 - s/MOZ_JEMALLOC3/MOZ_JEMALLOC4/. r=njn 2015-09-04 15:15:47 +09:00
Mike Hommey
4a986d4f4b Bug 1201738 - Update jemalloc4 to 594c759 + two pending patches. r=njn
Also do a dummy change to configure.in to trigger a reconfigure, working
around bug 1021347.
2015-09-04 14:35:55 +09:00
Mike Hommey
748d14b77a Bug 1141079 - Setup custom jemalloc chunk hooks to keep RSS usage low. r=njn 2015-09-04 14:35:54 +09:00
Mike Hommey
4fb6c55f9d Bug 1141079 - Make jemalloc_config.c a C++ source file. r=ted
--HG--
rename : memory/build/jemalloc_config.c => memory/build/jemalloc_config.cpp
2015-09-04 14:35:54 +09:00
Jan Beich
1df901bdce Bug 1201462 - Don't count arena allocated metadata once per bin. r=glandium 2015-09-04 14:35:52 +09:00
Nicholas Nethercote
e5dc6b8368 Bug 1200623 - Fix FdPrintf.o link error in --disable-optimize builds. r=glandium.
--HG--
extra : rebase_source : 2225f8496f540a01a19477e6e5e77cbc56877dea
2015-09-01 17:52:56 -07:00
Nicholas Nethercote
1dface560b Bug 1044077 - Tweak some jemalloc constants. r=glandium.
--HG--
extra : rebase_source : bfdb94191aa0872fd1aff52f143c63b0a3e41848
2015-07-14 20:35:37 -07:00
Nicholas Nethercote
a6522f55a6 Bug 1200097 - Fix warnings in logalloc. r=glandium.
--HG--
extra : rebase_source : 5f49243f7b46b411ec845c3f747fdb14bc959b07
2015-08-31 16:53:13 -07:00
Nicholas Nethercote
f44287005f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.

--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
2015-08-27 20:44:53 -07:00
Chris Peterson
1416e566de Bug 1198124 - Enable -Wshadow in directories that have no -Wshadow warnings. r=glandium 2015-08-25 09:14:38 -07:00
Mike Hommey
b6607b1ad5 Bug 1189967 - Avoid conflicting declarations for our raise wrappers on Windows. r=nfroyd 2015-08-23 22:22:26 +09:00
Mike Hommey
dea9486c28 Bug 1120793 - Remove obsolete _Throw wrapping. r=froydnj 2015-08-21 14:28:41 +09:00
Guilherme Goncalves
148b18ba80 Bug 1125514 - Use jemalloc's metadata statistics to compute bookkeeping. r=glandium 2015-08-20 10:05:44 +09:00
Andrew McCreight
ae06b3dd9d Bug 1179042 - Add a script for analyzing memory blocks using a heap scan DMD log. r=njn DONTBUILD
Based on:
0a68e57a2c/dmd/block_analyzer.py
2015-08-17 16:48:10 -07:00
Mike Hommey
3ec8bddc11 Bug 1142412 - Remove last jemalloc patch by using a workaround when running its configure. r=mshal 2015-08-18 08:42:24 +09:00
Mike Hommey
54863d2784 Bug 1142412 - Update memory/jemalloc to 4.0.0 release. r=njn 2015-08-18 08:42:23 +09:00
Nathan Froyd
cc763887fa Bug 1186444 - part 1 - move uses of MODULE_OPTIMIZE_FLAGS to moz.build's CFLAGS; r=mshal
Now that we have moz.build, we can be guaranteed that any flags we add
in moz.build will be added after everything else has been setup.  So any
uses of MODULE_OPTIMIZE_FLAGS can be moved to moz.build's
CFLAGS/CXXFLAGS without any unusual repercussions.  We do have to verify
that MOZ_OPTIMIZE is in effect, though.
2015-07-22 11:04:32 -04:00
Mike Hommey
d3beba14ab Bug 1137580 - Do not use system realloc in mozjemalloc-exposed _recalloc. r=njn 2015-08-07 16:27:28 +09:00
Nathan Froyd
5b16595e9b Bug 1191815 - move jemalloc CFLAGS definition to moz.build; r=mshal 2015-08-06 17:22:56 -04:00
Makoto Kato
ed0bf31fba Bug 830801 - Part 3. Remove NOMINMAX define from cpp source. r=mshal 2015-08-03 10:07:20 +09:00
Ehsan Akhgari
85cda505f8 Bug 1188209 - Fix more constructors in memory; r=njn 2015-07-28 08:53:29 -04:00
Birunthan Mohanathas
a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Andrew McCreight
6e608d39d9 Bug 1058178, part 2 - Implement address clamping analysis for DMD scan logs. r=njn
This adds a new option --clamp-contents to dmd.py. This replaces every value
contained in the memory contents in the log with a pointer to the start of a live
block, if the value is a pointer into the middle of that block. All other values
are replaced with 0. This conservative analysis makes it easier to determine
which blocks point to other blocks.
2015-06-30 11:54:15 -07:00
Andrew McCreight
1f8cde6f73 Bug 1058178, part 1 - Implement DMD heap scanning mode. r=njn
This implements a new "scan" mode for DMD that records the address
and contents of every live unsampled block in the DMD log. This
enables the low-level analysis of references from one block to
another, which can help leak investigations.
2015-06-30 11:54:15 -07:00
Benoit Girard
8d6a67f6d3 Bug 1172216 - Move nsStackwalk to mozglue. r=glandium
--HG--
rename : xpcom/base/nsStackWalk.cpp => mozglue/misc/StackWalk.cpp
rename : xpcom/base/nsStackWalk.h => mozglue/misc/StackWalk.h
extra : commitid : EMbWGfjKvdq
extra : rebase_source : b7308eb569cc1a019d3b7a92aaff0de7a49b5682
2015-06-10 16:32:45 -04:00
Ted Mielczarek
7958285841 bug 1171122 - Swap some XP_MACOSX for XP_DARWIN in mozalloc. r=glandium
--HG--
extra : commitid : 7pqjkOrdp47
extra : rebase_source : 08da613870a54423b33cecc615f46324db63f384
2015-03-27 22:53:02 -04:00
Andrew McCreight
e1908881c5 Bug 1172568 - Run test_dmd.js on OS X. r=njn 2015-06-10 07:24:00 -04:00
Mike Hommey
68221d7d35 Bug 1172668 - Unbreak DMD on OS X after bug 1168719. r=gps
Bug 1168719 added a generic replace malloc library which name happened to be
the same as the existing dummy library used to link replace malloc on OSX.
Change the name of that dummy library.
2015-06-10 10:49:22 +09:00
Mike Hommey
f61d5cbfd5 Bug 1172632 - Don't guess malloc_usable_size type of argument based on ANDROID_VERSION in mozjemalloc, but use the result of the configure test instead. r=njn 2015-06-10 10:49:21 +09:00
Andrew McCreight
2a29c1b921 Bug 1171647, part 2 - Remove redundant assertion for dark matter mode. r=njn 2015-06-06 14:44:19 -07:00
Andrew McCreight
7cb7fe1ebd Bug 1171647, part 1 - Define a new function to convert the mode to a string. r=njn 2015-06-06 14:44:19 -07:00
Mike Hommey
985ca5fd67 Bug 1168719 - Generic replace-malloc library. r=njn 2015-06-05 10:40:58 +09:00
Christian Holler
3091dad435 Bug 1170177 - Disable our own abort() method with MOZ_ASAN. r=froydnj 2015-06-02 23:25:01 +02:00
Leila Hadji
b544725c2c Bug 498166 - malloc_init deadlock due to pthread_atfork. r=glandium 2015-05-22 06:01:00 -04:00
David Major
0c7676f78d Bug 1135583: Prevent the inclusion of Char16.h in VS2015's fallible.obj. r=glandium
--HG--
extra : rebase_source : 1d1e1c9918461d692996d27becc857e60caaebd0
2015-05-21 08:03:48 -04:00
Mike Hommey
c917606f95 Bug 1043692 - Move DIST_INSTALL to moz.build. r=gps 2015-05-12 07:55:22 +09:00
Mike Hommey
fe90037862 Bug 1043692 - Add a DIST_INSTALL variable to moz.build, and replace NO_DIST_INSTALL with it. r=gps 2015-05-12 07:55:21 +09:00
Mike Hommey
924c9eb636 Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd
They are kept around for the sake of the standalone glue, which is used
for e.g. webapprt, which doesn't have direct access to jemalloc, and thus
still needs a wrapper to go through the xpcom function list and get to
jemalloc from there.
2015-05-01 09:40:30 +09:00
ziyunfei
e1db0f779e Bug 1102219 - Part 4: Replace String.prototype.contains with String.prototype.includes in chrome code. r=till 2015-04-30 00:32:05 +09:00
Ehsan Akhgari
9009ff92f8 Bug 1147243 - Build memory/jemalloc in unified mode; r=glandium 2015-04-29 09:47:36 -04:00
Paul Rouget
d60a1bd75e Bug 1156628 - Don't limit the number of unused dirty pages kept by jemalloc on B2G desktop. r=gsvelto, r=glandium 2015-04-24 03:58:00 -04:00
Jed Davis
5841b01411 Bug 1102388 - Fix DMD static constructor ordering dependency. r=mccr8
Sometimes, at least on Linux, DMDFuncs::sSingleton's static initializer
(in libxul) was being called before sDMDBridge's (in libdmd).
Thus sDMDBridge wasn't constructed yet in the path where its
address is taken, passed down through {replace_,}get_bridge to
ReplaceMallocBridge::Get, and its mVersion field is read.

This patch uses dynamic allocation, following what's done for other
globals in the same situation in this file.

Also, naming convention fix: leading "s" is for C++ class statics;
C-style static globals should be "g".

--HG--
extra : rebase_source : 4a6447760555aa11109749c612094ba1694b41f6
2015-04-20 23:05:00 +02:00
Ehsan Akhgari
399276d5fc Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 21:40:49 -04:00
Wes Kocher
638b28b8e0 Backed out changeset 02e6a50741a9 (bug 1153348) to hopefully fix the static bustage CLOSED TREE 2015-04-21 15:47:40 -07:00
Ehsan Akhgari
3d21a05904 Bug 1153348 - Add an analysis to prohibit operator bools which aren't marked as either explicit or MOZ_IMPLICIT; r=jrmuizel
This is the counterpart to the existing analysis to catch
constructors which aren't marked as either explicit or
MOZ_IMPLICIT.
2015-04-21 16:31:58 -04:00
Jed Davis
83dc2d2c83 Bug 1128705 - Don't redefine PAGE_SIZE in DMD if it's already defined. r=erahm
--HG--
extra : rebase_source : 978b2d5440e448dec97affa98c8f5c712fcbb051
2015-04-20 14:15:00 +02:00
Jim Blandy
a1f8669a0c Bug 1062473: Use mozalloc's moz_malloc_size_of in the JS shell, not our own custom copy. r=glandium
--HG--
extra : rebase_source : 0d35302f40bbc602d0338d1bcb563b045babd441
2015-04-13 16:11:32 -07:00
Jim Blandy
1121ad9a09 Bug 1145051: Don't include xpcom-config.h from mozalloc.h; it's unused. r=glandium
--HG--
extra : rebase_source : 7218f1f16db1d6c439583022c4dc73e4da8e4312
2015-03-19 01:03:05 -07:00
Jim Blandy
6afdd6c96b Bug 1145051: Use MOZ_WARN_UNUSED_RESULT instead of NS_WARN_UNUSED_RESULT. r=glandium
--HG--
extra : rebase_source : d210822225d307f3e3685cb5f95b461c48c0be7e
2015-03-19 00:46:40 -07:00
Jim Blandy
a778e9f970 Bug 1145051: Replace uses of NS_ATTR_MALLOC with new MOZ_ALLOCATOR from mfbt/Attributes.h. r=glandium
--HG--
extra : rebase_source : 294215445f084687ed7fa51b88e7a22e586447a2
2015-03-18 23:56:08 -07:00
ISHIKAWA, Chiaki
5933b89b08 Bug 1147248 - GCC 4.9 needs this patch to use address sanitizer. r=glandium
--HG--
extra : rebase_source : 08c553d5b5ff76abd81b070ccd6e2f058a2c4e4b
2015-04-10 15:05:00 +02:00
Mike Hommey
26b3c4f285 Bug 1138293 - Remove moz_malloc/moz_free/moz_realloc/moz_calloc. r=njn
We need to use _impl variants within mozalloc.h when they are defined because
of how mozglue.dll is linked on Windows, where using malloc/free would use
the symbols from the MSVCRT instead of ours.
2015-03-31 12:32:49 +09:00
Mike Hommey
7fef46c799 Bug 1142434 - Remove moz_memalign/moz_valloc, nothing uses them. r=njn 2015-03-31 12:26:45 +09:00
Mike Hommey
d0806aa5f6 Bug 1142434 - Remove moz_strdup/moz_strndup, nothing uses them. r=njn 2015-03-31 12:26:45 +09:00
Ehsan Akhgari
883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Mike Hommey
5b1c46a9cb Followup for bug 868814 - replace non-obvious #if with simpler alternative. rs=njn 2015-03-17 10:04:20 +09:00
Mike Hommey
b8f2a1380c Bug 1141731 - Avoid problems caused by the inclusion of mozmemory.h in mozalloc.cpp by including mozmemory_wrap.h instead. r=njn 2015-03-11 16:03:53 +09:00
Wes Kocher
b9f1c057ec Backed out changeset ff08cf105def (bug 1141731) for osx bustage 2015-03-10 18:34:28 -07:00
Mike Hommey
e5effb28c1 Bug 1141731 - Avoid problems caused by the inclusion of mozmemory.h in mozalloc.cpp by including mozmemory_wrap.h instead. r=njn 2015-03-11 09:52:04 +09:00
Mike Hommey
635ebcf228 Bug 1141660 - Fix bustage from bug 868814 with --disable-replace-malloc. r=njn 2015-03-11 09:52:03 +09:00
Mike Hommey
b35abc35cc Bug 1139357 - Make jemalloc3's --without-export actually work. r=njn 2015-03-10 10:01:53 +09:00
Mike Hommey
364038011c Bug 868814 - Fold mozalloc library into mozglue. r=njn
--HG--
rename : memory/mozalloc/moz.build => memory/mozalloc/staticruntime/moz.build
2015-03-10 10:01:52 +09:00
Mike Hommey
abd5c031e0 Bug 1138705 - Preserve LastError when calling TlsGetValue. r=njn
TlsGetValue has a semantic difference with pthread_getspecific, in that it
can return a non-error NULL value, so it always sets the LastError.
But allocator callers may not be expecting calling e.g. free() to change
the value of the last error, so preserve it.
2015-03-04 14:40:09 +09:00
Anish
4063a569ed Bug 958147 - Choose one of run-if or skip-if and get rid of the other.r=jmaher, mwargers 2015-03-03 08:46:37 -05:00
Mike Hommey
6dd0c8c299 Bug 762449 - Fix "result of 32-bit shift implicitly converted to 64 bits" on win64. r=njn 2015-03-02 07:35:28 +09:00
Mike Hommey
cefaffffe9 Bug 762449 - Make jemalloc's opt.lg_dirty_mult work as documented. r=njn 2015-03-02 07:35:28 +09:00
Chris Peterson
a7dcfcca64 Bug 1129326 - Remove nonstandard let blocks from memory/replace/dmd/test/test_dmd.js. r=njn 2015-01-24 23:37:31 -08:00
Brian Smith
1bb835dbca Bug 1128413, Part 4: Fix warnings in mozilla-config.h and gcc-stl-wrapper.template.h, r=glandium
--HG--
extra : rebase_source : 7ba4fb8a0bd11648908e2790e86ce3bb4517aeb7
2015-02-02 17:35:19 -08:00
Mike Hommey
a35dbaeebf Bug 1126593 - Add a global fallible instance, so that using fallible works directly, everywhere. r=njn
--HG--
rename : memory/mozalloc/fallible.h => memory/fallible/fallible.h
2015-02-02 09:56:13 +09:00
Mike Hommey
03b3291d3f Bug 1120272 - Expose _aligned_alloc and _aligned_free from mozglue. r=njn 2015-01-20 13:10:00 +09:00
Seth Fowler
fb673b7c3a Bug 1121297 (Part 2) - Make VolatileBuffer threadsafe. r=glandium 2015-01-16 15:47:35 -08:00
Seth Fowler
26bd4c1cb6 Bug 1121297 (Part 1) - Move VolatileBuffer into libxul. r=glandium
--HG--
rename : memory/mozalloc/VolatileBuffer.h => memory/volatile/VolatileBuffer.h
rename : memory/mozalloc/VolatileBufferAshmem.cpp => memory/volatile/VolatileBufferAshmem.cpp
rename : memory/mozalloc/VolatileBufferFallback.cpp => memory/volatile/VolatileBufferFallback.cpp
rename : memory/mozalloc/VolatileBufferOSX.cpp => memory/volatile/VolatileBufferOSX.cpp
rename : memory/mozalloc/VolatileBufferWindows.cpp => memory/volatile/VolatileBufferWindows.cpp
rename : memory/mozalloc/moz.build => memory/volatile/moz.build
rename : memory/mozalloc/tests/TestVolatileBuffer.cpp => memory/volatile/tests/TestVolatileBuffer.cpp
rename : memory/mozalloc/tests/moz.build => memory/volatile/tests/moz.build
2015-01-16 15:47:22 -08:00
Nicholas Nethercote
a479e9ccad Bug 1121830 - DMD: add "num" property to blocks in the output. r=mccr8.
The new "num" property lets identical blocks be aggregated in the output. This
patch only uses the "num" property for dead blocks, because that's where the
greatest potential benefit lies, but it could be used for live blocks as well.

On one test case (a complex PDF file) running with --mode=cumulative
--sample-below=1 this patch had the following effects.

- Change in running speed was negligible.

- Compressed output file size dropped from 8.8 to 5.0 MB.

- Compressed output file size dropped from 297 to 50 MB.

- dmd.py runtime (without stack fixing) dropped from 30 to 8 seconds.

--HG--
extra : rebase_source : 46a32058cd5c31cd823fe3f1accb5e68bcd320f3
2015-01-15 20:38:38 -08:00
Nicholas Nethercote
059cf96c41 Bug 1122337 - Mark DMD directories as FAIL_ON_WARNINGS. r=glandium.
The DEFINES and XPCOM_API changes are needed to get rid of "inconsistent dll
linkage" warnings on Windows builds.

--HG--
extra : rebase_source : 00756f51ebee85c70f65d51dbac17b4835262697
2015-01-15 21:17:18 -08:00
Mike Hommey
af38583e2e Bug 1121314 - Avoid needing the arena in chunk_alloc_default to avoid possible infinite loops involving a0malloc. r=njn
The infinite loop happens if chunk_alloc_arena needs to be called when a0malloc
is called. It in turn calls chunk_alloc_default, which uses tsd, which calls
a0malloc if it's the first time the tsd is being gotten from the current thread.
tsd only uses a0malloc on platforms where there is no native thread local storage
support, which, for Mozilla, essentially means anything that is not Linux.

But the tsd is only neededto get the dss precedence setting of the given arena.
That setting has no effect when dss is disabled, which it is on Windows and Mac.

Moreover, the default setting for dss precedence is "secondary", which means
jemalloc only tries dss after it failed to get memory with mmap/VirtualAlloc.
Considering the cases where mmap/VirtualAlloc would fail essentially means
there is shortage of address space, sbrk() is not going to have much more
success, so we might as well disable dss support on all platforms, avoiding
the infinite loop problem on Android and B2G as well.
2015-01-14 15:18:49 +09:00
Mike Hommey
2e083509f2 Bug 1120798 - Use a larger realloc in one of the DMD tests so that it passes for mozjemalloc as well as jemalloc3. r=njn 2015-01-14 15:18:49 +09:00
Masatoshi Kimura
bf312ad056 Bug 1120062 - Part 1: Remove most Nullptr.h includes. r=waldo 2015-01-11 11:34:52 +09:00
Brad Lassey
0e7333b6e7 bug 1083116 - build fails: malloc_decls.h conflicting types for 'malloc_usable_size' r=glandium 2015-01-06 19:58:36 -05:00
Nicholas Nethercote
cdd9ba9d57 Bug 1088343 (part 2) - Enable test_dmd on Win64. r=glandium.
--HG--
extra : rebase_source : b85a5e35c71f44d7f615bc67863711a4876e9da4
2015-01-08 16:04:43 -08:00
Ehsan Akhgari
4354953b4f Bug 1118486 - Part 1: Use = delete instead of MOZ_DELETE directly; r=Waldo
Most of this patch (with the exception of dom/bindings/Codegen.py) was
generated by the following bash script:

#!/bin/bash

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "*/.git*" \
       ! -wholename "obj-*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_DELETE '= delete'
2015-01-08 23:19:05 -05:00
Guilherme Goncalves
c6a10e7bb5 Bug 899126 - Part 2 - Measure bookkeeping in jemalloc3. r=glandium. 2014-12-29 13:42:14 -08:00
Guilherme Goncalves
750b113679 Bug 899126 - Part 1.5 - Implement bookkeeping for jemalloc3. r=glandium 2014-12-29 13:37:24 -08:00
Jan Beich
f4828d35f5 Bug 1115078 - Unbreak MOZ_JEMALLOC3 build on FreeBSD after bug 899126. r=glandium 2014-12-23 12:32:00 -05:00
Guilherme Goncalves
1fb7597a1b Bug 1110514 - Use arena.<i>.purge to free jemalloc3's dirty pages. r=glandium 2014-12-23 02:41:00 -05:00
Guilherme Goncalves
802cb55877 Bug 1108045 - Junk memory with jemalloc3. r=glandium 2014-12-23 07:44:00 -05:00
Guilherme Goncalves
f9d70a5255 Bug 762448 - Bump opt.lg_dirty_mult in jemalloc3 to reduce number of dirty pages. r=glandium 2014-12-23 06:01:00 -05:00
Guilherme Goncalves
5ff0106324 Bug 762448 - Deduct bin_unused from waste in jemalloc3's stats. r=glandium 2014-11-12 13:00:00 -05:00
Ryan VanderMeulen
42a3e6c0ea Merge m-c to inbound. a=merge 2014-12-23 13:18:02 -05:00
Guilherme Goncalves
c41a18c8d2 Bug 1112566 - Add a isblank definition for MSVC < 2013. r=glandium 2014-12-23 15:27:19 +09:00
Guilherme Goncalves
aa02623d99 Bug 1112566 - Move variable declaration to the top its block for MSVC compatibility. r=jasone,r=glandium 2014-12-23 15:27:18 +09:00
Vladimir Vukicevic
a910628209 Bug 1112566 - Use jemalloc C99 msvc compat headers when building mozjemalloc compat glue and jemalloc3 replace-malloc library. r=glandium 2014-12-23 15:27:18 +09:00
Guilherme Goncalves
22c6a4800b Bug 899126 - Part 1: Implement bin_unused for jemalloc3. r=glandium 2014-12-19 09:15:00 -05:00
Nicholas Nethercote
53da6fb716 Bug 1112968 - dmd.py: Tweak the --alloc-fns list for better effect on Windows. r=mccr8.
--HG--
extra : rebase_source : 3dc8a09f9a22bf234406c0ff89d7b4050c7908e7
2014-12-18 18:59:53 -08:00
Nicholas Nethercote
8030658f62 Bug 1112968 - dmd.py: Tweak the --alloc-fns list for better effect on Mac. r=mccr8.
--HG--
extra : rebase_source : 03dbab1eeb4e3f99672a174277ba634a39a98292
2014-12-17 19:10:59 -08:00
Guilherme Goncalves
60eb32a82c Bug 1094275 - Update the in-tree copy of jemalloc3 to commit b4acf73. r=glandium 2014-12-17 09:14:48 +09:00
Nicholas Nethercote
658df429fc Bug 1110455 - Add --sort-by=num-blocks option to dmd.py. r=mccr8.
--HG--
extra : rebase_source : 6d6aa87f102ee069f4f5052607463380c656f80d
2014-12-15 15:04:39 -08:00
Nicholas Nethercote
e358318e29 Bug 1111419 - dmd.py: add a cache for recordKeyParts. r=mccr8.
This reduces the runtime on my Linux machine for one large DMD output file from
235 seconds to 105 seconds.

--HG--
extra : rebase_source : bd567319c1207a09fa47b94571066109de1cc9e7
2014-12-15 15:04:34 -08:00
Ehsan Akhgari
ebdf8e7c36 Bug 1109746 - Fix more bad implicit constructors in some random code across the tree
--HG--
extra : amend_source : 48ca151cb1ca2193404c65831556051c02093914
2014-12-13 14:17:04 -05:00
Ryan VanderMeulen
9a56a97e41 Backed out changesets 34a66a625618, 32db3daa20fe, and ac15ba8568c5 (bug 1102219) for Gaia unit test failures.
--HG--
extra : rebase_source : 0266cc0b2a6568ca653885745f381df8d6d167ec
2014-12-11 11:28:30 -05:00
ziyunfei
5f470bd4a1 Bug 1102219 - Part 3: Replace String.prototype.contains with String.prototype.includes in chrome code. r=till 2014-12-10 20:50:00 -05:00
Chris Peterson
793516eb34 Bug 1108934 - Fix -Wunused-const-variable warning-as-error in non-unified build of memory/mozalloc. r=glandium 2014-12-08 21:26:27 -08:00
Nicholas Nethercote
ee6de8d6c9 Bug 1100851 - Print the mode in dmd.py's output. r=mccr8.
--HG--
extra : rebase_source : ae0f985ba8a74dfec8a36ff1a380279ed18b675b
2014-12-10 13:33:50 -08:00
Nicholas Nethercote
98688c1a41 Bug 1100851 - Tweak DMD to account for the fact that $DMD can now be undefined. r=glandium.
Now that defining $DMD is no longer necessary to run DMD, this patch does the
following.
- Removes all the places where we set DMD=1 (test harnesses, etc.)
- Still handles DMD=1, for backwards compatibility.
- Prints "$DMD is undefined" at DMD start-up if appropriate.
- Writes a |null| value for |dmdEnvVar| in the JSON if $DMD is undefined. Bumps
  the DMD output version number accordingly.
- Changes a bunch of the test files accordingly, including changing the mode of
  script-ignore-alloc-fns.json in order to test a case where $DMD is undefined.

--HG--
extra : rebase_source : eb1ef5722410734ce6d7658465ff6f442ee4ed49
2014-11-27 21:04:46 -08:00