зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868814 - Fold mozalloc library into mozglue. r=njn
--HG-- rename : memory/mozalloc/moz.build => memory/mozalloc/staticruntime/moz.build
This commit is contained in:
Родитель
dadd824d2c
Коммит
364038011c
|
@ -69,7 +69,6 @@
|
|||
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
|
||||
#ifdef MOZ_DMD
|
||||
@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#ifdef GKMEDIAS_SHARED_LIBRARY
|
||||
@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
|
||||
#ifdef MOZ_SHARED_MOZGLUE
|
||||
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
|
||||
#endif
|
||||
|
|
|
@ -32,12 +32,15 @@ def GeckoBinary(linkage='dependent', msvcrt='dynamic', mozglue=None):
|
|||
xpcomglue = 'xpcomglue_staticruntime'
|
||||
if not CONFIG['GNU_CC']:
|
||||
mozglue = None
|
||||
if linkage == 'dependent':
|
||||
USE_LIBS += [
|
||||
'mozalloc_staticruntime',
|
||||
]
|
||||
else:
|
||||
error('msvcrt must be "dynamic" or "static"')
|
||||
|
||||
if linkage == 'dependent':
|
||||
USE_LIBS += [
|
||||
'mozalloc',
|
||||
'nspr',
|
||||
'%s_s' % xpcomglue,
|
||||
'xul',
|
||||
|
|
|
@ -15,13 +15,16 @@ else:
|
|||
}
|
||||
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
|
||||
kwargs['msvcrt'] = 'static'
|
||||
if not CONFIG['GNU_CC']:
|
||||
USE_LIBS += [
|
||||
'mozalloc_staticruntime',
|
||||
]
|
||||
GeckoProgram(CONFIG['MOZ_CHILD_PROCESS_NAME'], **kwargs)
|
||||
|
||||
SOURCES += [
|
||||
'MozillaRuntimeMain.cpp',
|
||||
]
|
||||
USE_LIBS += [
|
||||
'mozalloc',
|
||||
'nspr',
|
||||
'xul',
|
||||
]
|
||||
|
@ -51,7 +54,6 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
|
|||
'sandbox_staticruntime_s',
|
||||
]
|
||||
DELAYLOAD_DLLS += [
|
||||
'mozalloc.dll',
|
||||
'nss3.dll',
|
||||
'xul.dll'
|
||||
]
|
||||
|
|
|
@ -10,7 +10,6 @@ with Files('**'):
|
|||
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
|
||||
GeckoSharedLibrary('gkmedias', linkage=None)
|
||||
USE_LIBS += [
|
||||
'mozalloc',
|
||||
'nspr',
|
||||
]
|
||||
else:
|
||||
|
|
|
@ -38,11 +38,7 @@ UNIFIED_SOURCES += [
|
|||
'mozalloc_oom.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
Library('mozalloc')
|
||||
else:
|
||||
GeckoSharedLibrary('mozalloc', linkage=None)
|
||||
SDK_LIBRARY = True
|
||||
FINAL_LIBRARY = 'mozglue'
|
||||
|
||||
# The strndup declaration in string.h is in an ifdef __USE_GNU section
|
||||
DEFINES['_GNU_SOURCE'] = True
|
||||
|
@ -53,3 +49,8 @@ DISABLE_STL_WRAPPING = True
|
|||
|
||||
if CONFIG['CLANG_CXX'] or CONFIG['_MSC_VER']:
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
DEFINES['IMPL_MFBT'] = True
|
||||
|
||||
if CONFIG['_MSC_VER']:
|
||||
DIRS += ['staticruntime']
|
||||
|
|
|
@ -5,33 +5,66 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
// Building with USE_STATIC_LIBS = True sets -MT instead of -MD. -MT sets _MT,
|
||||
// while -MD sets _MT and _DLL.
|
||||
#if defined(_MT) && !defined(_DLL)
|
||||
#define MOZ_STATIC_RUNTIME
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_MEMORY) && !defined(MOZ_STATIC_RUNTIME)
|
||||
// mozalloc.cpp is part of the same library as mozmemory, thus MOZ_MEMORY_IMPL
|
||||
// is needed.
|
||||
#define MOZ_MEMORY_IMPL
|
||||
#include "mozmemory.h"
|
||||
|
||||
// See mozmemory_wrap.h for more details. This file is part of libmozglue, so
|
||||
// it needs to use _impl suffixes. However, with libmozglue growing, this is
|
||||
// becoming cumbersome, so we will likely use a malloc.h wrapper of some sort
|
||||
// and allow the use of the functions without a _impl suffix.
|
||||
#define MALLOC_DECL(name, return_type, ...) \
|
||||
extern "C" MOZ_MEMORY_API return_type name ## _impl(__VA_ARGS__);
|
||||
#define MALLOC_FUNS MALLOC_FUNCS_MALLOC
|
||||
#include "malloc_decls.h"
|
||||
|
||||
extern "C" MOZ_MEMORY_API char *strdup_impl(const char *);
|
||||
extern "C" MOZ_MEMORY_API char *strndup_impl(const char *, size_t);
|
||||
|
||||
#else
|
||||
// When jemalloc is disabled, or when building the static runtime variant,
|
||||
// we need not to use the suffixes.
|
||||
|
||||
#if defined(MALLOC_H)
|
||||
# include MALLOC_H // for memalign, valloc, malloc_size, malloc_us
|
||||
#endif // if defined(MALLOC_H)
|
||||
#include <stdlib.h> // for malloc, free
|
||||
#if defined(XP_UNIX)
|
||||
# include <unistd.h> // for valloc on *BSD
|
||||
#endif //if defined(XP_UNIX)
|
||||
|
||||
#define malloc_impl malloc
|
||||
#define posix_memalign_impl posix_memalign
|
||||
#define calloc_impl calloc
|
||||
#define realloc_impl realloc
|
||||
#define free_impl free
|
||||
#define memalign_impl memalign
|
||||
#define valloc_impl valloc
|
||||
#define malloc_usable_size_impl malloc_usable_size
|
||||
#define strdup_impl strdup
|
||||
#define strndup_impl strndup
|
||||
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <new> // for std::bad_alloc
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(MALLOC_H)
|
||||
# include MALLOC_H // for memalign, valloc, malloc_size, malloc_usable_size
|
||||
#endif // if defined(MALLOC_H)
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdlib.h> // for malloc, free
|
||||
#if defined(XP_UNIX)
|
||||
# include <unistd.h> // for valloc on *BSD
|
||||
#endif //if defined(XP_UNIX)
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/mozalloc_oom.h" // for mozalloc_handle_oom
|
||||
|
||||
/* Windows doesn't have malloc_usable_size, but jemalloc has */
|
||||
#if defined(MOZ_MEMORY_WINDOWS)
|
||||
extern "C" size_t malloc_usable_size(const void *ptr);
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define LIKELY(x) (__builtin_expect(!!(x), 1))
|
||||
#define UNLIKELY(x) (__builtin_expect(!!(x), 0))
|
||||
|
@ -43,13 +76,13 @@ extern "C" size_t malloc_usable_size(const void *ptr);
|
|||
void
|
||||
moz_free(void* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
free_impl(ptr);
|
||||
}
|
||||
|
||||
void*
|
||||
moz_xmalloc(size_t size)
|
||||
{
|
||||
void* ptr = malloc(size);
|
||||
void* ptr = malloc_impl(size);
|
||||
if (UNLIKELY(!ptr && size)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xmalloc(size);
|
||||
|
@ -59,13 +92,13 @@ moz_xmalloc(size_t size)
|
|||
void*
|
||||
moz_malloc(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
return malloc_impl(size);
|
||||
}
|
||||
|
||||
void*
|
||||
moz_xcalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void* ptr = calloc(nmemb, size);
|
||||
void* ptr = calloc_impl(nmemb, size);
|
||||
if (UNLIKELY(!ptr && nmemb && size)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xcalloc(nmemb, size);
|
||||
|
@ -75,13 +108,13 @@ moz_xcalloc(size_t nmemb, size_t size)
|
|||
void*
|
||||
moz_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
return calloc(nmemb, size);
|
||||
return calloc_impl(nmemb, size);
|
||||
}
|
||||
|
||||
void*
|
||||
moz_xrealloc(void* ptr, size_t size)
|
||||
{
|
||||
void* newptr = realloc(ptr, size);
|
||||
void* newptr = realloc_impl(ptr, size);
|
||||
if (UNLIKELY(!newptr && size)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xrealloc(ptr, size);
|
||||
|
@ -91,13 +124,13 @@ moz_xrealloc(void* ptr, size_t size)
|
|||
void*
|
||||
moz_realloc(void* ptr, size_t size)
|
||||
{
|
||||
return realloc(ptr, size);
|
||||
return realloc_impl(ptr, size);
|
||||
}
|
||||
|
||||
char*
|
||||
moz_xstrdup(const char* str)
|
||||
{
|
||||
char* dup = strdup(str);
|
||||
char* dup = strdup_impl(str);
|
||||
if (UNLIKELY(!dup)) {
|
||||
mozalloc_handle_oom(0);
|
||||
return moz_xstrdup(str);
|
||||
|
@ -107,14 +140,14 @@ moz_xstrdup(const char* str)
|
|||
char*
|
||||
moz_strdup(const char* str)
|
||||
{
|
||||
return strdup(str);
|
||||
return strdup_impl(str);
|
||||
}
|
||||
|
||||
#if defined(HAVE_STRNDUP)
|
||||
char*
|
||||
moz_xstrndup(const char* str, size_t strsize)
|
||||
{
|
||||
char* dup = strndup(str, strsize);
|
||||
char* dup = strndup_impl(str, strsize);
|
||||
if (UNLIKELY(!dup)) {
|
||||
mozalloc_handle_oom(strsize);
|
||||
return moz_xstrndup(str, strsize);
|
||||
|
@ -124,7 +157,7 @@ moz_xstrndup(const char* str, size_t strsize)
|
|||
char*
|
||||
moz_strndup(const char* str, size_t strsize)
|
||||
{
|
||||
return strndup(str, strsize);
|
||||
return strndup_impl(str, strsize);
|
||||
}
|
||||
#endif // if defined(HAVE_STRNDUP)
|
||||
|
||||
|
@ -132,7 +165,7 @@ moz_strndup(const char* str, size_t strsize)
|
|||
int
|
||||
moz_xposix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
{
|
||||
int err = posix_memalign(ptr, alignment, size);
|
||||
int err = posix_memalign_impl(ptr, alignment, size);
|
||||
if (UNLIKELY(err && ENOMEM == err)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xposix_memalign(ptr, alignment, size);
|
||||
|
@ -143,7 +176,7 @@ moz_xposix_memalign(void **ptr, size_t alignment, size_t size)
|
|||
int
|
||||
moz_posix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
{
|
||||
int code = posix_memalign(ptr, alignment, size);
|
||||
int code = posix_memalign_impl(ptr, alignment, size);
|
||||
if (code)
|
||||
return code;
|
||||
|
||||
|
@ -167,7 +200,7 @@ moz_posix_memalign(void **ptr, size_t alignment, size_t size)
|
|||
void*
|
||||
moz_xmemalign(size_t boundary, size_t size)
|
||||
{
|
||||
void* ptr = memalign(boundary, size);
|
||||
void* ptr = memalign_impl(boundary, size);
|
||||
if (UNLIKELY(!ptr && EINVAL != errno)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xmemalign(boundary, size);
|
||||
|
@ -178,7 +211,7 @@ moz_xmemalign(size_t boundary, size_t size)
|
|||
void*
|
||||
moz_memalign(size_t boundary, size_t size)
|
||||
{
|
||||
return memalign(boundary, size);
|
||||
return memalign_impl(boundary, size);
|
||||
}
|
||||
#endif // if defined(HAVE_MEMALIGN)
|
||||
|
||||
|
@ -186,7 +219,7 @@ moz_memalign(size_t boundary, size_t size)
|
|||
void*
|
||||
moz_xvalloc(size_t size)
|
||||
{
|
||||
void* ptr = valloc(size);
|
||||
void* ptr = valloc_impl(size);
|
||||
if (UNLIKELY(!ptr)) {
|
||||
mozalloc_handle_oom(size);
|
||||
return moz_xvalloc(size);
|
||||
|
@ -196,10 +229,11 @@ moz_xvalloc(size_t size)
|
|||
void*
|
||||
moz_valloc(size_t size)
|
||||
{
|
||||
return valloc(size);
|
||||
return valloc_impl(size);
|
||||
}
|
||||
#endif // if defined(HAVE_VALLOC)
|
||||
|
||||
#if !(defined(_MT) && !defined(_DLL))
|
||||
size_t
|
||||
moz_malloc_usable_size(void *ptr)
|
||||
{
|
||||
|
@ -209,7 +243,7 @@ moz_malloc_usable_size(void *ptr)
|
|||
#if defined(XP_MACOSX)
|
||||
return malloc_size(ptr);
|
||||
#elif defined(HAVE_MALLOC_USABLE_SIZE) || defined(MOZ_MEMORY)
|
||||
return malloc_usable_size(ptr);
|
||||
return malloc_usable_size_impl(ptr);
|
||||
#elif defined(XP_WIN)
|
||||
return _msize(ptr);
|
||||
#else
|
||||
|
@ -221,3 +255,4 @@ size_t moz_malloc_size_of(const void *ptr)
|
|||
{
|
||||
return moz_malloc_usable_size((void *)ptr);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -24,23 +24,10 @@
|
|||
#include "mozilla/TemplateLib.h"
|
||||
#endif
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Types.h"
|
||||
|
||||
#define MOZALLOC_HAVE_XMALLOC
|
||||
|
||||
#if defined(MOZALLOC_EXPORT)
|
||||
/* do nothing: it's been defined to __declspec(dllexport) by
|
||||
* mozalloc*.cpp on platforms where that's required. */
|
||||
#elif defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllimport)
|
||||
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
|
||||
/* Make sure symbols are still exported even if we're wrapped in a
|
||||
* |visibility push(hidden)| blanket. */
|
||||
# define MOZALLOC_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
# define MOZALLOC_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(MOZ_ALWAYS_INLINE_EVEN_DEBUG)
|
||||
# define MOZALLOC_INLINE MOZ_ALWAYS_INLINE_EVEN_DEBUG
|
||||
#elif defined(HAVE_FORCEINLINE)
|
||||
|
@ -75,73 +62,73 @@ extern "C" {
|
|||
* passing that pointer to |moz_free()|.
|
||||
*/
|
||||
|
||||
MOZALLOC_EXPORT
|
||||
MFBT_API
|
||||
void moz_free(void* ptr);
|
||||
|
||||
MOZALLOC_EXPORT void* moz_xmalloc(size_t size)
|
||||
MFBT_API void* moz_xmalloc(size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT
|
||||
MFBT_API
|
||||
void* moz_malloc(size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
MOZALLOC_EXPORT void* moz_xcalloc(size_t nmemb, size_t size)
|
||||
MFBT_API void* moz_xcalloc(size_t nmemb, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT void* moz_calloc(size_t nmemb, size_t size)
|
||||
MFBT_API void* moz_calloc(size_t nmemb, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
MOZALLOC_EXPORT void* moz_xrealloc(void* ptr, size_t size)
|
||||
MFBT_API void* moz_xrealloc(void* ptr, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT void* moz_realloc(void* ptr, size_t size)
|
||||
MFBT_API void* moz_realloc(void* ptr, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
MOZALLOC_EXPORT char* moz_xstrdup(const char* str)
|
||||
MFBT_API char* moz_xstrdup(const char* str)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT char* moz_strdup(const char* str)
|
||||
MFBT_API char* moz_strdup(const char* str)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT size_t moz_malloc_usable_size(void *ptr);
|
||||
MFBT_API size_t moz_malloc_usable_size(void *ptr);
|
||||
|
||||
MOZALLOC_EXPORT size_t moz_malloc_size_of(const void *ptr);
|
||||
MFBT_API size_t moz_malloc_size_of(const void *ptr);
|
||||
|
||||
#if defined(HAVE_STRNDUP)
|
||||
MOZALLOC_EXPORT char* moz_xstrndup(const char* str, size_t strsize)
|
||||
MFBT_API char* moz_xstrndup(const char* str, size_t strsize)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT char* moz_strndup(const char* str, size_t strsize)
|
||||
MFBT_API char* moz_strndup(const char* str, size_t strsize)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
#endif /* if defined(HAVE_STRNDUP) */
|
||||
|
||||
|
||||
#if defined(HAVE_POSIX_MEMALIGN)
|
||||
MOZALLOC_EXPORT int moz_xposix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
MFBT_API int moz_xposix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT int moz_posix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
MFBT_API int moz_posix_memalign(void **ptr, size_t alignment, size_t size)
|
||||
NS_WARN_UNUSED_RESULT;
|
||||
#endif /* if defined(HAVE_POSIX_MEMALIGN) */
|
||||
|
||||
|
||||
#if defined(HAVE_MEMALIGN)
|
||||
MOZALLOC_EXPORT void* moz_xmemalign(size_t boundary, size_t size)
|
||||
MFBT_API void* moz_xmemalign(size_t boundary, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT void* moz_memalign(size_t boundary, size_t size)
|
||||
MFBT_API void* moz_memalign(size_t boundary, size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
#endif /* if defined(HAVE_MEMALIGN) */
|
||||
|
||||
|
||||
#if defined(HAVE_VALLOC)
|
||||
MOZALLOC_EXPORT void* moz_xvalloc(size_t size)
|
||||
MFBT_API void* moz_xvalloc(size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
|
||||
MOZALLOC_EXPORT void* moz_valloc(size_t size)
|
||||
MFBT_API void* moz_valloc(size_t size)
|
||||
NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
|
||||
#endif /* if defined(HAVE_VALLOC) */
|
||||
|
||||
|
@ -176,7 +163,7 @@ MOZALLOC_EXPORT void* moz_valloc(size_t size)
|
|||
* visibility on OS X/gcc. These symbols are force-inline and not
|
||||
* exported. */
|
||||
#if defined(XP_MACOSX)
|
||||
# define MOZALLOC_EXPORT_NEW MOZALLOC_EXPORT
|
||||
# define MOZALLOC_EXPORT_NEW MFBT_API
|
||||
#else
|
||||
# define MOZALLOC_EXPORT_NEW
|
||||
#endif
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "mozilla/mozalloc_abort.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
|
|
|
@ -9,19 +9,7 @@
|
|||
#define mozilla_mozalloc_abort_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#if defined(MOZALLOC_EXPORT)
|
||||
// do nothing: it's been defined to __declspec(dllexport) by
|
||||
// mozalloc*.cpp on platforms where that's required
|
||||
#elif defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllimport)
|
||||
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
|
||||
/* Make sure symbols are still exported even if we're wrapped in a
|
||||
* |visibility push(hidden)| blanket. */
|
||||
# define MOZALLOC_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
# define MOZALLOC_EXPORT
|
||||
#endif
|
||||
#include "mozilla/Types.h"
|
||||
|
||||
/**
|
||||
* Terminate this process in such a way that breakpad is triggered, if
|
||||
|
@ -30,7 +18,7 @@
|
|||
* Note: MOZ_NORETURN seems to break crash stacks on ARM, so we don't
|
||||
* use that annotation there.
|
||||
*/
|
||||
MOZALLOC_EXPORT
|
||||
MFBT_API
|
||||
#if !defined(__arm__)
|
||||
MOZ_NORETURN
|
||||
#endif
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "mozilla/mozalloc_abort.h"
|
||||
#include "mozilla/mozalloc_oom.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
|
|
@ -10,28 +10,11 @@
|
|||
|
||||
#include "mozalloc.h"
|
||||
|
||||
#if defined(MOZALLOC_EXPORT)
|
||||
// do nothing: it's been defined to __declspec(dllexport) by
|
||||
// mozalloc*.cpp on platforms where that's required
|
||||
#elif defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllimport)
|
||||
#elif defined(HAVE_VISIBILITY_ATTRIBUTE)
|
||||
/* Make sure symbols are still exported even if we're wrapped in a
|
||||
* |visibility push(hidden)| blanket. */
|
||||
# define MOZALLOC_EXPORT __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
# define MOZALLOC_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Called when memory is critically low. Returns iff it was able to
|
||||
* Called when memory is critically low. Returns iff it was able to
|
||||
* remedy the critical memory situation; if not, it will abort().
|
||||
*
|
||||
* We have to re-#define MOZALLOC_EXPORT because this header can be
|
||||
* used indepedently of mozalloc.h.
|
||||
*/
|
||||
MOZALLOC_EXPORT void mozalloc_handle_oom(size_t requestedSize);
|
||||
MFBT_API void mozalloc_handle_oom(size_t requestedSize);
|
||||
|
||||
/**
|
||||
* Called by embedders (specifically Mozilla breakpad) which wants to be
|
||||
|
@ -39,7 +22,7 @@ MOZALLOC_EXPORT void mozalloc_handle_oom(size_t requestedSize);
|
|||
* the size of the allocation on which we aborted.
|
||||
*/
|
||||
typedef void (*mozalloc_oom_abort_handler)(size_t size);
|
||||
MOZALLOC_EXPORT void mozalloc_set_oom_abort_handler(mozalloc_oom_abort_handler handler);
|
||||
MFBT_API void mozalloc_set_oom_abort_handler(mozalloc_oom_abort_handler handler);
|
||||
|
||||
/* TODO: functions to query system memory usage and register
|
||||
* critical-memory handlers. */
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "mozalloc_abort.h"
|
||||
|
||||
#define MOZALLOC_DONT_WRAP_RAISE_FUNCTIONS
|
||||
|
|
|
@ -23,11 +23,11 @@ namespace std {
|
|||
// doing this after careful review because we want to define our own
|
||||
// exception throwing semantics. Don't try this at home!
|
||||
|
||||
MOZALLOC_EXPORT __declspec(noreturn) void moz_Xinvalid_argument(const char*);
|
||||
MOZALLOC_EXPORT __declspec(noreturn) void moz_Xlength_error(const char*);
|
||||
MOZALLOC_EXPORT __declspec(noreturn) void moz_Xout_of_range(const char*);
|
||||
MOZALLOC_EXPORT __declspec(noreturn) void moz_Xoverflow_error(const char*);
|
||||
MOZALLOC_EXPORT __declspec(noreturn) void moz_Xruntime_error(const char*);
|
||||
MFBT_API __declspec(noreturn) void moz_Xinvalid_argument(const char*);
|
||||
MFBT_API __declspec(noreturn) void moz_Xlength_error(const char*);
|
||||
MFBT_API __declspec(noreturn) void moz_Xout_of_range(const char*);
|
||||
MFBT_API __declspec(noreturn) void moz_Xoverflow_error(const char*);
|
||||
MFBT_API __declspec(noreturn) void moz_Xruntime_error(const char*);
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
#include <exception>
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# define MOZALLOC_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "mozilla/mozalloc_abort.h"
|
||||
|
||||
namespace std {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
NO_VISIBILITY_FLAGS = True
|
||||
|
||||
if CONFIG['MOZ_MSVC_STL_WRAP_RAISE'] or CONFIG['MOZ_MSVC_STL_WRAP_Throw']:
|
||||
build_msvc_wrappers = 1
|
||||
else:
|
||||
build_msvc_wrappers = 0
|
||||
|
||||
if CONFIG['WRAP_STL_INCLUDES']:
|
||||
DEFINES['_HAS_EXCEPTIONS'] = 0
|
||||
if build_msvc_wrappers:
|
||||
SOURCES += [
|
||||
'../msvc_raise_wrappers.cpp',
|
||||
'../msvc_throw_wrapper.cpp',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'../mozalloc.cpp',
|
||||
'../mozalloc_abort.cpp',
|
||||
'../mozalloc_oom.cpp',
|
||||
]
|
||||
|
||||
GENERATED_INCLUDES += ['/xpcom']
|
||||
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
DEFINES['IMPL_MFBT'] = True
|
||||
|
||||
USE_STATIC_LIBS = True
|
||||
|
||||
Library('mozalloc_staticruntime')
|
|
@ -42,7 +42,6 @@
|
|||
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@omxplugin@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@omxplugingb@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@omxplugingb235@DLL_SUFFIX@
|
||||
|
|
|
@ -18,7 +18,6 @@ LOCAL_INCLUDES += [
|
|||
]
|
||||
|
||||
USE_LIBS += [
|
||||
'mozalloc',
|
||||
'mozillapkix',
|
||||
'nspr',
|
||||
'nss',
|
||||
|
|
|
@ -11,7 +11,6 @@ SOURCES += [
|
|||
]
|
||||
|
||||
USE_LIBS += [
|
||||
'mozalloc',
|
||||
'nspr',
|
||||
'nss',
|
||||
]
|
||||
|
|
|
@ -113,7 +113,6 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
|
|||
|
||||
USE_LIBS += [
|
||||
'gkmedias',
|
||||
'mozalloc',
|
||||
'nspr',
|
||||
'nss',
|
||||
'sqlite',
|
||||
|
|
|
@ -270,7 +270,6 @@ include $(MOZILLA_DIR)/config/android-common.mk
|
|||
DIST_FILES =
|
||||
|
||||
# Place the files in the order they are going to be opened by the linker
|
||||
DIST_FILES += libmozalloc.so
|
||||
ifndef MOZ_FOLD_LIBS
|
||||
DIST_FILES += \
|
||||
libnspr4.so \
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIRS += ['standalone', 'nomozalloc']
|
||||
DIRS += ['standalone']
|
||||
|
||||
# On win we build two glue libs - glue linked to crt dlls here and in staticruntime we build
|
||||
# a statically linked glue lib.
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIST_INSTALL = 1
|
||||
# Force to build a static library only
|
||||
NO_EXPAND_LIBS = 1
|
|
@ -1,49 +0,0 @@
|
|||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include('../objs.mozbuild')
|
||||
|
||||
UNIFIED_SOURCES += xpcom_gluens_src_cppsrcs
|
||||
UNIFIED_SOURCES += xpcom_glue_src_cppsrcs
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'../GenericModule.cpp',
|
||||
'../nsStringAPI.cpp',
|
||||
]
|
||||
|
||||
Library('xpcomglue_s_nomozalloc')
|
||||
|
||||
SDK_LIBRARY = True
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = True
|
||||
|
||||
if CONFIG['_MSC_VER']:
|
||||
DEFINES['_USE_ANSI_CPP'] = True
|
||||
# Don't include directives about which CRT to use
|
||||
CFLAGS += ['-Zl']
|
||||
CXXFLAGS += ['-Zl']
|
||||
|
||||
DEFINES['MOZ_NO_MOZALLOC'] = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../build',
|
||||
]
|
||||
|
||||
# Pretend we're statically linking the CRT, even though we might not be: this
|
||||
# avoids "msvcrp" and assembly dependencies from creeping into the directives
|
||||
# for this library on Windows.
|
||||
USE_STATIC_LIBS = True
|
||||
|
||||
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
# Include fallible for third party code using the xpcom glue
|
||||
USE_LIBS += [
|
||||
'fallible',
|
||||
]
|
|
@ -56,7 +56,7 @@ FULL_NSPR_LIBS=$(subst $(prefix),\$${sdkdir},$(shell $(DEPTH)/nsprpub/config/nsp
|
|||
NSPR_VERSION=$(shell $(DEPTH)/nsprpub/config/nspr-config --version)
|
||||
endif
|
||||
|
||||
MOZ_XUL_LINK = -lxpcomglue_s -lxul -lmozalloc
|
||||
MOZ_XUL_LINK = -lxpcomglue_s -lxul
|
||||
ifdef JS_SHARED_LIBRARY
|
||||
MOZ_JS_LINK = -lmozjs
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче