mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1257448 - Move --enable-jemalloc and MOZ_JEMALLOC4 to moz.configure. r=nalexander
At the same time, allow to enable jemalloc 4 with --enable-jemalloc=4. MOZ_JEMALLOC4 will be deprecated later. This also changes the semantics for freebsd, where the system jemalloc is used, relying on MOZ_MEMORY being unset (default on freebsd) and MOZ_JEMALLOC4 to be set. In this new setup, MOZ_JEMALLOC4 implies --enable-jemalloc=4, which still works because of the corresponding changes to old-configure.
This commit is contained in:
parent
5d68eb47bb
commit
d685556de0
57
build/moz.configure/memory.configure
Normal file
57
build/moz.configure/memory.configure
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- 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/.
|
||||
|
||||
|
||||
option(env='MOZ_JEMALLOC4', help='Enable jemalloc 4')
|
||||
imply_option('--enable-jemalloc', depends_if('MOZ_JEMALLOC4')(lambda x: '4'))
|
||||
|
||||
|
||||
option('--enable-jemalloc', nargs='?', choices=('4',), env='MOZ_MEMORY',
|
||||
help='Replace memory allocator with jemalloc')
|
||||
|
||||
@depends('--enable-jemalloc', target, build_project, c_compiler)
|
||||
def jemalloc(value, target, build_project, c_compiler):
|
||||
if value.origin != 'default':
|
||||
return bool(value) or None
|
||||
|
||||
if build_project == 'js':
|
||||
return True
|
||||
|
||||
if target.kernel == 'Darwin' and target.cpu == 'x86_64':
|
||||
# Don't enable by default on 32-bits OSX. See bug 702250.
|
||||
return True
|
||||
|
||||
if target.kernel == 'WINNT' and c_compiler.type in ('msvc', 'clang-cl'):
|
||||
return True
|
||||
|
||||
if target.kernel == 'Linux':
|
||||
return True
|
||||
|
||||
@depends('--enable-jemalloc')
|
||||
def jemalloc4(jemalloc):
|
||||
if len(jemalloc) and jemalloc[0] == '4':
|
||||
return True
|
||||
|
||||
|
||||
set_config('MOZ_MEMORY', jemalloc)
|
||||
set_define('MOZ_MEMORY', jemalloc)
|
||||
add_old_configure_assignment('MOZ_MEMORY', jemalloc)
|
||||
|
||||
set_config('MOZ_JEMALLOC4', jemalloc4)
|
||||
set_define('MOZ_JEMALLOC4', jemalloc4)
|
||||
add_old_configure_assignment('MOZ_JEMALLOC4', jemalloc4)
|
||||
|
||||
|
||||
# Because --enable-jemalloc doesn't use a default because of the dependency
|
||||
# on the target, we can't use a js_option for it to propagate to js/src
|
||||
# through the old-configure.
|
||||
@depends(jemalloc, jemalloc4)
|
||||
def jemalloc_for_old_configure(jemalloc, jemalloc4):
|
||||
if jemalloc:
|
||||
return '--enable-jemalloc=4' if jemalloc4 else '--enable-jemalloc'
|
||||
return '--disable-jemalloc'
|
||||
|
||||
add_old_configure_arg(jemalloc_for_old_configure)
|
@ -198,7 +198,6 @@ def old_configure_options(*options):
|
||||
'--enable-ion',
|
||||
'--enable-ios-target',
|
||||
'--enable-ipdl-tests',
|
||||
'--enable-jemalloc',
|
||||
'--enable-jitspew',
|
||||
'--enable-libjpeg-turbo',
|
||||
'--enable-libproxy',
|
||||
|
@ -1975,18 +1975,6 @@ dnl ========================================================
|
||||
dnl = Enable jemalloc
|
||||
dnl ========================================================
|
||||
|
||||
LOCAL_MOZ_MEMORY=1
|
||||
MOZ_ARG_DISABLE_BOOL(jemalloc,
|
||||
[ --disable-jemalloc Don't replace memory allocator with jemalloc],
|
||||
LOCAL_MOZ_MEMORY=)
|
||||
|
||||
dnl Consult the command-line arguments in stand alone-builds only. In
|
||||
dnl non-stand-alone builds, we always use the value of MOZ_MEMORY inherited from
|
||||
dnl the top-level configure script.
|
||||
if test "$JS_STANDALONE"; then
|
||||
MOZ_MEMORY=$LOCAL_MOZ_MEMORY
|
||||
fi
|
||||
|
||||
case "${OS_TARGET}" in
|
||||
Android|WINNT|Darwin)
|
||||
MOZ_GLUE_IN_PROGRAM=
|
||||
@ -1999,7 +1987,6 @@ Android|WINNT|Darwin)
|
||||
esac
|
||||
|
||||
if test "$MOZ_MEMORY"; then
|
||||
AC_DEFINE(MOZ_MEMORY)
|
||||
if test "x$MOZ_DEBUG" = "x1"; then
|
||||
AC_DEFINE(MOZ_MEMORY_DEBUG)
|
||||
fi
|
||||
@ -2032,11 +2019,6 @@ if test "$MOZ_MEMORY"; then
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(MOZ_MEMORY)
|
||||
AC_SUBST(MOZ_JEMALLOC4)
|
||||
if test -n "$MOZ_JEMALLOC4"; then
|
||||
AC_DEFINE(MOZ_JEMALLOC4)
|
||||
fi
|
||||
AC_SUBST(MOZ_CRT)
|
||||
AC_SUBST(MOZ_GLUE_IN_PROGRAM)
|
||||
AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
|
||||
|
@ -46,20 +46,27 @@ option('--disable-compile-environment',
|
||||
help='Disable compiler/library checks')
|
||||
|
||||
@depends('--disable-compile-environment')
|
||||
def compile_environment(value):
|
||||
if value:
|
||||
def compile_environment(compile_env):
|
||||
if compile_env:
|
||||
return True
|
||||
|
||||
set_config('COMPILE_ENVIRONMENT', compile_environment)
|
||||
add_old_configure_assignment('COMPILE_ENVIRONMENT', compile_environment)
|
||||
|
||||
@depends('--disable-compile-environment', '--help')
|
||||
def toolchain_include(value, help):
|
||||
if value:
|
||||
def toolchain_include(compile_env, help):
|
||||
if compile_env:
|
||||
return 'build/moz.configure/toolchain.configure'
|
||||
|
||||
include(toolchain_include)
|
||||
|
||||
@depends('--disable-compile-environment', '--help')
|
||||
def memory_include(compile_env, help):
|
||||
if compile_env:
|
||||
return 'build/moz.configure/memory.configure'
|
||||
|
||||
include(memory_include)
|
||||
|
||||
|
||||
@depends('--help')
|
||||
@imports(_from='mozbuild.backend', _import='backends')
|
||||
|
@ -1147,7 +1147,6 @@ if test "$MOZ_DMD"; then
|
||||
CXXFLAGS="$CXXFLAGS -funwind-tables"
|
||||
fi
|
||||
|
||||
MOZ_MEMORY=1 # DMD enables jemalloc
|
||||
MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
|
||||
fi
|
||||
|
||||
@ -1237,10 +1236,6 @@ case "$target" in
|
||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
MOZ_OPTIMIZE_FLAGS="-O3"
|
||||
# Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
|
||||
if test "$HAVE_64BIT_BUILD"; then
|
||||
MOZ_MEMORY=1
|
||||
fi
|
||||
DLL_SUFFIX=".dylib"
|
||||
DSO_LDOPTS=''
|
||||
STRIP_FLAGS="$STRIP_FLAGS -x -S"
|
||||
@ -1334,8 +1329,6 @@ case "$target" in
|
||||
fi
|
||||
fi
|
||||
|
||||
MOZ_MEMORY=1
|
||||
|
||||
case "${target_cpu}" in
|
||||
alpha*)
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
@ -1556,7 +1549,6 @@ case "$target" in
|
||||
HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
|
||||
dnl allow AVX2 code from VS2012
|
||||
HAVE_X86_AVX2=1
|
||||
MOZ_MEMORY=1
|
||||
fi
|
||||
AC_DEFINE(STDC_HEADERS)
|
||||
AC_DEFINE(WIN32_LEAN_AND_MEAN)
|
||||
@ -2801,7 +2793,6 @@ case "${target}" in
|
||||
NSS_DISABLE_DBM=1
|
||||
MOZ_THEME_FASTSTRIPE=1
|
||||
MOZ_TREE_FREETYPE=1
|
||||
MOZ_MEMORY=1
|
||||
MOZ_RAW=1
|
||||
;;
|
||||
|
||||
@ -5606,14 +5597,6 @@ if test -n "$MOZ_DEBUG"; then
|
||||
AC_DEFINE(MOZ_DUMP_PAINTING)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable jemalloc
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(jemalloc,
|
||||
[ --enable-jemalloc Replace memory allocator with jemalloc],
|
||||
MOZ_MEMORY=1,
|
||||
MOZ_MEMORY=)
|
||||
|
||||
case "${OS_TARGET}" in
|
||||
Android|WINNT|Darwin)
|
||||
MOZ_GLUE_IN_PROGRAM=
|
||||
@ -5704,18 +5687,6 @@ dnl ========================================================
|
||||
dnl = Jemalloc build setup
|
||||
dnl ========================================================
|
||||
if test -z "$MOZ_MEMORY"; then
|
||||
if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
|
||||
MOZ_SYSTEM_JEMALLOC=1
|
||||
AC_CHECK_FUNCS(mallctl nallocx,,
|
||||
[MOZ_SYSTEM_JEMALLOC=
|
||||
break])
|
||||
if test -n "$MOZ_SYSTEM_JEMALLOC"; then
|
||||
MOZ_MEMORY=1
|
||||
AC_DEFINE(MOZ_MEMORY)
|
||||
AC_DEFINE(MOZ_JEMALLOC4)
|
||||
AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
|
||||
fi
|
||||
fi
|
||||
case "${target}" in
|
||||
*-mingw*)
|
||||
if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
|
||||
@ -5724,9 +5695,14 @@ if test -z "$MOZ_MEMORY"; then
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AC_DEFINE(MOZ_MEMORY)
|
||||
if test -n "$MOZ_JEMALLOC4"; then
|
||||
AC_DEFINE(MOZ_JEMALLOC4)
|
||||
if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
|
||||
MOZ_SYSTEM_JEMALLOC=1
|
||||
AC_CHECK_FUNCS(mallctl nallocx,,
|
||||
[MOZ_SYSTEM_JEMALLOC=
|
||||
break])
|
||||
if test -n "$MOZ_SYSTEM_JEMALLOC"; then
|
||||
AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
|
||||
fi
|
||||
fi
|
||||
if test "x$MOZ_DEBUG" = "x1"; then
|
||||
AC_DEFINE(MOZ_MEMORY_DEBUG)
|
||||
@ -5770,8 +5746,6 @@ else
|
||||
;;
|
||||
esac
|
||||
fi # MOZ_MEMORY
|
||||
AC_SUBST(MOZ_MEMORY)
|
||||
AC_SUBST(MOZ_JEMALLOC4)
|
||||
AC_SUBST(MOZ_SYSTEM_JEMALLOC)
|
||||
AC_SUBST(MOZ_CRT)
|
||||
export MOZ_CRT
|
||||
@ -7578,9 +7552,6 @@ if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
|
||||
ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
|
||||
fi
|
||||
ac_configure_args="$ac_configure_args --prefix=$dist"
|
||||
if test "$MOZ_MEMORY"; then
|
||||
ac_configure_args="$ac_configure_args --enable-jemalloc"
|
||||
fi
|
||||
if test -n "$ZLIB_IN_MOZGLUE"; then
|
||||
MOZ_ZLIB_LIBS=
|
||||
fi
|
||||
@ -7598,7 +7569,6 @@ unset MOZ_BUILD_APP
|
||||
export DIST
|
||||
export MOZ_LINKER
|
||||
export ZLIB_IN_MOZGLUE
|
||||
export MOZ_MEMORY
|
||||
export AR
|
||||
export RANLIB
|
||||
export CPP
|
||||
|
@ -65,6 +65,7 @@ set_config('MOZ_DMD', dmd)
|
||||
set_define('MOZ_DMD', dmd)
|
||||
add_old_configure_assignment('MOZ_DMD', dmd)
|
||||
imply_option('--enable-profiling', dmd)
|
||||
imply_option('--enable-jemalloc', dmd)
|
||||
|
||||
# Javascript engine
|
||||
# ==============================================================
|
||||
|
Loading…
Reference in New Issue
Block a user