Bug 418016 - "Ts jumped ~1% when enabling jemalloc on Linux (qm-mini-ubuntu01, qm-mini-ubuntu02, qm-mini-ubuntu05)" (Integrate jemalloc into libxul on Linux) [p=jasone@canonware.com (Jason Evans) r=bsmedberg sr+a1.9=stuart]
authorreed@reedloden.com
Fri, 14 Mar 2008 08:38:37 -0700
changeset 13070 f78fd5a9c306459508756ccc10f1895ec58cd182
parent 13069 7d0fdec7b101084bd08b4df82a33efe0ca4d9cfc
child 13071 71a73815eab45969981d03021681d7ec26ba6b9b
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs418016
milestone1.9b5pre
Bug 418016 - "Ts jumped ~1% when enabling jemalloc on Linux (qm-mini-ubuntu01, qm-mini-ubuntu02, qm-mini-ubuntu05)" (Integrate jemalloc into libxul on Linux) [p=jasone@canonware.com (Jason Evans) r=bsmedberg sr+a1.9=stuart]
browser/app/Makefile.in
browser/installer/removed-files.in
browser/installer/unix/packages-static
memory/jemalloc/Makefile.in
toolkit/library/Makefile.in
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -68,17 +68,17 @@ DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)
 DIST_FILES = application.ini
 
 GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
 GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
 
 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
 
 ifdef MOZ_MEMORY
-ifneq ($(OS_ARCH),WINNT)
+ifeq ($(OS_ARCH),Darwin)
 LIBS += -ljemalloc
 endif
 endif
 
 ifdef LIBXUL_SDK
 include $(topsrcdir)/config/rules.mk
 else
 # Build a binary bootstrapping with XRE_main
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -584,16 +584,17 @@ init.d/README
 redo-prebinding.sh
 res/viewer.properties
 res/bloatcycle.html
 #endif
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 readme.txt
 chrome/icons/default/default.xpm
+libjemalloc.so
 #endif
 #endif
 dictionaries/PL.dic
 dictionaries/PL.aff
 #ifdef XP_WIN
 #ifdef MOZ_MEMORY
 Microsoft.VC80.CRT.manifest
 msvcm80.dll
--- a/browser/installer/unix/packages-static
+++ b/browser/installer/unix/packages-static
@@ -46,17 +46,16 @@ bin/@MOZ_APP_NAME@-bin
 bin/@MOZ_APP_NAME@
 bin/application.ini
 bin/platform.ini
 bin/mozilla-xremote-client
 bin/run-mozilla.sh
 bin/plugins/libnullplugin.so
 bin/libsqlite3.so
 bin/README.txt
-bin/libjemalloc.so
 
 ; [Components]
 bin/components/alerts.xpt
 bin/components/accessibility.xpt
 bin/components/appshell.xpt
 bin/components/appstartup.xpt
 bin/components/autocomplete.xpt
 bin/components/autoconfig.xpt
--- a/memory/jemalloc/Makefile.in
+++ b/memory/jemalloc/Makefile.in
@@ -76,21 +76,28 @@ libs:: $(CRT_OBJ_DIR)/build/intel/mozcrt
 	rm $(CRT_OBJ_DIR)/build/intel/{libcmt,libcpmt}.lib
 else
 # Using a pre-built DLL, so just install it.
 libs:: $(WIN32_CUSTOM_CRT_DIR)/mozcrt19.dll
 	$(INSTALL) $< $(FINAL_TARGET)
 endif
 
 else
-# for other platforms, just build jemalloc as a shared lib
 
 MODULE_OPTIMIZE_FLAGS = -O2
 LIBRARY_NAME	= jemalloc
+
+ifeq (Darwin,$(OS_TARGET))
+# Build jemalloc as a shared lib, so that the library init function is executed.
 FORCE_SHARED_LIB= 1
+else
+# Make jemalloc part of libxul, in order to reduce dynamic loading overhead.
+MODULE		= jemalloc
+LIBXUL_LIBRARY	= 1
+endif
 
 CSRCS		= \
 		jemalloc.c \
 		$(NULL)
 
 #XXX: PGO on Linux causes problems here
 # See bug 419470
 NO_PROFILE_GUIDED_OPTIMIZE = 1
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -244,8 +244,16 @@ endif
 ifdef MOZ_JAVAXPCOM
 dlldeps-javaxpcom.cpp: $(topsrcdir)/extensions/java/xpcom/src/dlldeps-javaxpcom.cpp
 	$(INSTALL) $^ .
 endif
 
 ifneq (,$(filter layout-debug,$(MOZ_EXTENSIONS)))
 DEFINES += -DMOZ_ENABLE_EXTENSION_LAYOUT_DEBUG
 endif
+
+ifdef MOZ_MEMORY
+ifneq ($(OS_ARCH),WINNT)
+ifneq ($(OS_ARCH),Darwin)
+EXTRA_DSO_LDOPTS += $(DEPTH)/memory/jemalloc/$(LIB_PREFIX)jemalloc.$(LIB_SUFFIX)
+endif
+endif
+endif