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

219 Коммитов

Автор SHA1 Сообщение Дата
Nathan Froyd 9133c59dba Bug 1442325 - remove some dead preprocessor logic; r=glandium
We always compile with C++11 (er, C++14), so there's no need to include
clauses that suggest otherwise.
2018-03-02 07:06:08 -05:00
Mike Hommey 3e46ee7dc9 Bug 1417504 - Also wrap Heap{Alloc,ReAlloc,Free} when building without our allocator. r=njn
Bug 1280578 added some wrapping for the Win32 Heap* functions, mainly
for the rust static libraries that use them. Because pointer ownership
might cross the C++/Rust boundary, and because about:memory uses
malloc_usable_size/msize, we need both C++ and Rust to still use the
same heap on builds where our allocator is not enabled.

--HG--
extra : rebase_source : 37a25b376a02ea07c187fb161d2005141e783820
2017-12-19 14:46:23 +09:00
Gurzau Raul 91d3bc0100 Merge inbound to mozilla-central r=merge a=merge 2017-12-09 00:36:15 +02:00
Ryan VanderMeulen 01e424a4bc Bug 1423649 - Fix compiler errors that happen when building with VS2017 15.5. r=rillian 2017-12-08 10:40:08 -05:00
Sylvestre Ledru 5de63ef061 Bug 1394734 - Replace CONFIG['MSVC'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 5orfnoude7h

--HG--
extra : rebase_source : 1ed9a6b56e1d27221a07624767a7fb0e6147117f
2017-12-08 13:46:13 +01:00
Sylvestre Ledru 9bfe27d903 Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 7duJk2gSd4m

--HG--
extra : rebase_source : 7312fe276e561e8c034a5f6749774ae812727f9c
2017-12-07 22:09:15 +01:00
Mike Hommey cd4d96f039 Bug 1424114 - Remove the string.h/cstring include in mozalloc.h. r=njn
While here, change the string.h include to cstring in mozalloc.cpp.

--HG--
extra : rebase_source : d60eac8b5fdb358b43eb32978d5d40a426d50648
2017-12-08 11:47:15 +09:00
Mike Hommey abab5abf88 Bug 1423803 - Turn mozilla::fallible into an alias for std::nothrow. r=njn
The std::nothrow variant of operator new is effectively a fallible
operator new. It is used in third party code.

The duplication with our own fallible operator new is unfortunate, and
we can reduce it by making one an alias of the other.

We keep the fallible library as a dummy on Android because bug 1423802
induces some linking problems.

--HG--
extra : rebase_source : d7b915aaafde40057e87b7ad4bbd82d348e4f12d
2017-12-07 11:32:29 +09:00
Mike Hommey 627d9acca4 Bug 1423461 - Report the right size to the OOM handler for moz_xcalloc. r=njn
--HG--
extra : rebase_source : 536f6504394b14a4968b24fbc719017111a428cf
2017-12-06 16:10:30 +09:00
Mike Hommey 33ca8ff779 Bug 1423461 - Use mozilla/Likely.h in mozalloc.cpp. r=njn
Back when mozalloc.cpp was written, mozilla/Likely.h didn't exist.

--HG--
extra : rebase_source : da3b4c8839a97e3ac2d40da158905ac38c088683
2017-12-06 16:05:08 +09:00
Mike Hommey a646756fb7 Bug 1423461 - Use noexcept in mozalloc.h on android. r=njn
Bug 1163171 removed support for building for android with GCC, and we
don't need to use throw() anymore. We can use the same code as for other
non-Windows platforms.

--HG--
extra : rebase_source : 9c2c2179a6d214096619ff0ae1d1a42912beda79
2017-12-06 11:38:59 +09:00
Mike Hommey 41a56e83c2 Bug 1423461 - Remove MOZALLOC_INLINE, and always use MOZ_ALWAYS_INLINE_EVEN_DEBUG. r=njn
MOZ_ALWAYS_INLINE_EVEN_DEBUG is always defined through
mozilla/Attributes.h, so the fallbacks are never used in practice. They
are just there from the old days when mozalloc.h didn't use
mozilla/Attributes.h.

--HG--
extra : rebase_source : 0d55068ab5fcec3f4bcafecd8c3ce371597f8cfe
2017-12-06 11:31:48 +09:00
Mike Hommey 3f1f5c9fc2 Bug 1423114 - Remove moz_xposix_memalign and moz_xvalloc. r=njn
They are both infallible wrappers of posix_memalign and valloc.
There is also moz_xmemalign, which wraps memalign, which is mostly
always available as of bug 1402647.

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

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

--HG--
extra : rebase_source : 1c3ca4b3e3310543145f3181dfa4e764be1d6ff8
2017-12-05 17:34:19 +09:00
Mike Hommey 4c95537eeb Bug 1423094 - Remove USE_STATIC_LIBS=True-related code in mozalloc. r=gps
--HG--
extra : rebase_source : 52a4df6d15f9aa5eb0479cef4e98e9e41eb5164c
2017-12-05 16:30:21 +09:00
Mike Hommey 8aa92edf03 Bug 1423094 - Remove mozalloc_staticruntime. r=gps
--HG--
extra : rebase_source : 3b6678d4b36e405b2acc18b8fd75b5db7d45bf4c
2017-12-05 15:39:39 +09:00
Narcis Beleuzu dfd58840d1 Backed out changeset 8a4050c7e0fd (bug 1423114) for bustages on memory/mozalloc/mozalloc.cpp r=backout on a CLOSED TREE 2017-12-06 00:27:11 +02:00
Mike Hommey a1947c3098 Bug 1423119 - Remove the sole use of MOZALLOC_HAVE_XMALLOC. r=erahm
When this was added, the xpcom glue was still a thing, and there was a
distinction between things that would build with mozalloc available and
others. There is no such distinction anymore. Anything that has access
to xpcom has access to infallible allocator functions.

--HG--
extra : rebase_source : 04bce114e940c53709275d0354ea7240df4a051e
2017-12-05 17:45:20 +09:00
Mike Hommey 5f1f0bbdc4 Bug 1423114 - Remove moz_xposix_memalign and moz_xvalloc. r=njn
They are both infallible wrappers of posix_memalign and valloc.
There is also moz_xmemalign, which wraps memalign, which is always
available as of bug 1402647.

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

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

--HG--
extra : rebase_source : 17300bc03a715e5d36b4b687f22050622c1c70c8
2017-12-05 17:34:19 +09:00
Mike Hommey a5aef799e1 Bug 1423109 - Use MOZ_{BEGIN,END}_EXTERN_C in mozalloc.h. r=njn
--HG--
extra : rebase_source : 9d1c8c59b58273c1efe9a124e41eccc254600346
2017-12-05 17:04:45 +09:00
Mike Hommey 660ec9e47b Bug 1423109 - Remove Sun Pro compiler specific preprocessor directives from mozalloc.h. r=njn
As of bug 1255813, compiling with Sun Pro compiler is not supported.

--HG--
extra : rebase_source : 3c925ec389a5607047330f743d45f3c5eca7b7f8
2017-12-05 17:00:02 +09:00
Mike Hommey 1b2c8764a2 Bug 1423107 - Remove moz_posix_memalign. r=njn
--HG--
extra : rebase_source : 47e9db8d98082fbccdb80c5ac0ca21fff0c5c888
2017-12-05 16:52:34 +09:00
Nathan Froyd f51359bd19 Bug 1325632 - part 5 - ensure that we compile with -fno-sized-deallocation when possible; r=chmanchester
We currently turn off the C++14 sized-deallocation facility on MSVC, and
we'd like to ensure we do the same thing for clang and gcc.  To do so,
we add new functionality to moz.configure for checking and adding
compilation flags, similar to the facility for checking and adding
warning flags.  The newly added facility is then used to add
-fno-sized-deallocation to the compilation flags, when the option is
supported.

Once we do this, we can't define the sized deallocation functions in
mozalloc.h; the compiler will complain that we are using
-fno-sized-deallocation, yet defining these special functions that we'll
never use.  These functions were added for MinGW, where we needed to
compile with C++14 ahead of other platforms to be compatible with MSVC
headers.  But they're no longer necessary, though they would be if we
removed -fno-sized-deallocation; the compiler will complain if we do
that and we'll add them back at that point.
2017-11-15 14:53:16 -04:00
Sylvestre Ledru d60d69e2cb Bug 1411001 - Remove the +x permissions on cpp & h files r=froydnj
MozReview-Commit-ID: DjDkL20wRg0

--HG--
extra : rebase_source : a343d83d1f4e97e4ba56d0f57fec93079df0b5ea
2017-10-23 20:59:55 +02:00
Tom Ritter fdab21a20a Bug 1406197 Declare sized deallocators (that ignore the size) to correct a MinGW warning r=glandium
MozReview-Commit-ID: Dl4uu6evlbs

--HG--
extra : rebase_source : f9b04123b1f09a49155f0bb24704f9e11818ff5a
2017-10-10 13:16:10 -05:00
Nathan Froyd f8fda5a9b5 Bug 1396889 - don't warn about infinite recursion in mozalloc_abort; r=glandium
mozalloc_abort is not marked as a noreturn function on ARM, so clang
complains when abort calls mozalloc_abort, which calls MOZ_CRASH, which
calls abort().  We know this is OK, so just disable the warning.
2017-09-14 09:52:50 -04:00
Chris Manchester fab07bc443 Bug 1386876 - Replace all uses of NO_VISIBILITY_FLAGS with a template and remove NO_VISIBILITY_FLAGS. r=glandium
MozReview-Commit-ID: 194U1WMCAM0

--HG--
extra : rebase_source : 365b68b0a1772d238ae9b84966e53dcd1197fd85
2017-05-01 18:12:35 -07:00
Chris Manchester c0a229d4c3 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP

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

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

--HG--
extra : rebase_source : caa19cccf8c2d1f79cf004fe6a408775de5a7b22
2017-08-24 19:37:27 +10:00
Botond Ballo b93629ee1d Bug 1383919 - Use |noexcept| instead of an exception-specification in mozalloc.h. r=glandium
MozReview-Commit-ID: DwrE8cmZOQN

--HG--
extra : rebase_source : e45f35dd009a3a8a94f50afc55177976c532f16a
2017-07-24 19:19:07 -04:00
Petr Sumbera a393f2a6cf Bug 1375467 - Redefining abort() in C++ requires extern "C". r=glandium 2017-06-22 05:09:05 -07:00
Jeff Gilbert 58ae26fbc7 Bug 1376057 - Replace MSVC wrappers with std::exception::_Set_raise_handler. - r=froydnj
MozReview-Commit-ID: MG5c4bzDlI
2017-06-27 11:51:34 -07:00
Mike Hommey 0400284f88 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++.

--HG--
extra : rebase_source : af55696262f40a9dd16a19c29edcb9bb307d4957
2017-05-16 18:46:02 +09:00
Carsten "Tomcat" Book 9c3f61e278 Backed out changeset b56224bf370d (bug 1365194) 2017-05-17 11:43:26 +02:00
Mike Hommey 2bd75405bc 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++.

--HG--
extra : rebase_source : af55696262f40a9dd16a19c29edcb9bb307d4957
2017-05-16 18:46:02 +09:00
Tom Ritter f8036e08d5 Bug 1332747 Change MOZ_ALWAYS_INLINE to MOZ_ALWAYS_INLINE_EVEN_DEBUG to fix MinGW Debug build r=froydnj
MozReview-Commit-ID: 7CkreJM1mHr

--HG--
extra : rebase_source : 8dc51c9c1b0e10bd7b40f3c6f65b2495dfe22cb1
2017-04-11 12:53:58 -05:00
Bevis Tseng 2a318e8c71 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
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
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
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
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 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
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
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