Skip to content

Commit

Permalink
Bug 678195 - Remove old style jemalloc. r=khuey
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Aug 23, 2011
1 parent 26b79dc commit 07abe0b
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 1,215 deletions.
4 changes: 0 additions & 4 deletions browser/installer/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ endif
include $(topsrcdir)/ipc/app/defs.mk
DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)

ifdef WIN32_OLD_STYLE_JEMALLOC
DEFINES += -DWIN32_OLD_STYLE_JEMALLOC=1
endif

ifneq (,$(filter aurora beta,$(MOZ_UPDATE_CHANNEL)))
DEFINES += -DSHIP_FEEDBACK=1
endif
Expand Down
5 changes: 0 additions & 5 deletions browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
#endif
#ifdef XP_WIN32
#ifdef WIN32_OLD_STYLE_JEMALLOC
@BINPATH@/mozcrt19.dll
@BINPATH@/mozcpp19.dll
#else
#ifdef MOZ_MEMORY
@BINPATH@/jemalloc.dll
#endif
Expand All @@ -81,7 +77,6 @@
@BINPATH@/msvcp100.dll
@BINPATH@/msvcr100.dll
#endif
#endif

#endif

Expand Down
11 changes: 2 additions & 9 deletions browser/installer/removed-files.in
Original file line number Diff line number Diff line change
Expand Up @@ -1272,15 +1272,8 @@ xpicleanup@BIN_SUFFIX@
components/nsPostUpdateWin.js
js3250.dll
plugins/npnul32.dll
#ifdef WIN32_OLD_STYLE_JEMALLOC
Microsoft.VC80.CRT.manifest
msvcm80.dll
msvcp80.dll
msvcr80.dll
#else
mozcrt19.dll
mozcpp19.dll
#endif
mozcrt19.dll
mozcpp19.dll
#endif
@DLL_PREFIX@xpcom_core@DLL_SUFFIX@
components/@DLL_PREFIX@jar50@DLL_SUFFIX@
Expand Down
2 changes: 0 additions & 2 deletions build/win32/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ endif # ENABLE_TESTS

include $(topsrcdir)/config/rules.mk

ifndef WIN32_OLD_STYLE_JEMALLOC
ifdef WIN32_REDIST_DIR
ifndef MOZ_DEBUG

Expand Down Expand Up @@ -101,4 +100,3 @@ endif

endif # ! MOZ_DEBUG
endif # WIN32_REDIST_DIR
endif # ! MOZ_MEMORY
2 changes: 0 additions & 2 deletions config/autoconf.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,7 @@ MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
MOZ_QUANTIFY = @MOZ_QUANTIFY@
MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
WIN32_OLD_STYLE_JEMALLOC = @WIN32_OLD_STYLE_JEMALLOC@
WIN32_CRT_LIBS = @WIN32_CRT_LIBS@
MOZ_CRT_CPU_ARCH = @MOZ_CRT_CPU_ARCH@

Expand Down
60 changes: 12 additions & 48 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -7418,54 +7418,20 @@ else
;;
*-mingw*)
AC_DEFINE(MOZ_MEMORY_WINDOWS)
AC_MSG_CHECKING([for VC2005/2008++ CRT source])
if test "$CC_VERSION" == "14.00.50727.762" -o "$CC_VERSION" == "15.00.30729.01"; then
if test -z "$WIN32_CRT_SRC_DIR" -a -n "$VCINSTALLDIR"; then
WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
fi
if test -n "$WIN32_CRT_SRC_DIR" -a -d "$WIN32_CRT_SRC_DIR"; then
AC_MSG_RESULT([yes])
dnl cpu check
case "${target_cpu}" in
i*86)
MOZ_CRT_CPU_ARCH=intel
;;
x86_64)
MOZ_CRT_CPU_ARCH=amd64
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
;;
esac
AC_SUBST(MOZ_CRT_CPU_ARCH)
WIN32_OLD_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_OLD_STYLE_JEMALLOC)
WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
_objdir_win=`pwd -W`
WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
fi
if test -z "$MOZ_DEBUG"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
else
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
fi
if test -z "$WIN32_OLD_STYLE_JEMALLOC"; then
AC_MSG_RESULT([no])
WIN32_NEW_STYLE_JEMALLOC=1
AC_DEFINE(WIN32_NEW_STYLE_JEMALLOC)
WIN32_CRT_SRC_DIR=
if test -z "$MOZ_DEBUG"; then
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
else
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
fi
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
fi
rm crtdll.obj
dnl Look for a broken crtdll.obj
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
MOZ_MEMORY_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
else
MOZ_MEMORY_LDFLAGS='$(DIST)/../memory/jemalloc/jemalloc.lib'
fi
rm crtdll.obj

dnl Also pass this to NSPR/NSS
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
Expand All @@ -7485,9 +7451,7 @@ else
fi # MOZ_MEMORY
AC_SUBST(MOZ_MEMORY)
AC_SUBST(MOZ_MEMORY_LDFLAGS)
AC_SUBST(WIN32_OLD_STYLE_JEMALLOC)
AC_SUBST(WIN32_CRT_LIBS)
AC_SUBST(WIN32_CRT_SRC_DIR)
dnl Need to set this for make because NSS doesn't have configure
AC_SUBST(DLLFLAGS)

Expand Down
74 changes: 2 additions & 72 deletions memory/jemalloc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,70 +49,11 @@ MODULE = jemalloc
# symbols.
VISIBILITY_FLAGS=

ifeq (WINNT,$(OS_TARGET))
ifdef WIN32_OLD_STYLE_JEMALLOC
# Building the CRT from source
CRT_OBJ_DIR = $(CURDIR)/crtsrc
MOZ_CRT_DLL_NAME = mozcrt19
MOZ_CRTCPP_DLL_NAME = mozcpp19
MOZ_CRT_STATIC_LIBS = libcmt libcpmt
MOZ_CRT_DLL = $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/$(MOZ_CRT_DLL_NAME).dll
MOZ_CRT_IMPORT_LIB = $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/$(MOZ_CRT_DLL_NAME).lib
MOZ_CRTCPP_DLL = $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/$(MOZ_CRTCPP_DLL_NAME).dll
MOZ_CRTCPP_IMPORT_LIB = $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/$(MOZ_CRTCPP_DLL_NAME).lib

# copy the CRT DLLs to dist/bin,
# copy the import libs to dist/lib
libs:: $(MOZ_CRT_DLL) $(MOZ_CRT_IMPORT_LIB)
$(INSTALL) $(MOZ_CRT_DLL) $(MOZ_CRTCPP_DLL) $(FINAL_TARGET)
$(INSTALL) $(MOZ_CRT_IMPORT_LIB) $(MOZ_CRTCPP_IMPORT_LIB) $(DIST)/lib

$(MOZ_CRT_IMPORT_LIB): $(MOZ_CRT_DLL)

define EXTRACT_CMD
cd $(CRT_OBJ_DIR)/$(MOZ_CRT_CPU_ARCH)/$(i)_lib && lib "-extract:..\\build\\$(MOZ_CRT_CPU_ARCH)\\$(i)_obj\\unhandld.obj" eh.lib

endef # don't touch the blank line. actually, don't touch anything in this file.

# patch if necessary
ifeq ($(CC_VERSION), 14.00.50727.762)
CRTDIFF=crtvc8sp1-$(MOZ_CRT_CPU_ARCH).diff
else
CRTDIFF=crtvc9sp1-$(MOZ_CRT_CPU_ARCH).diff
endif

$(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/$(CRTDIFF)
rm -rf $(CRT_OBJ_DIR)
cp -R "$(WIN32_CRT_SRC_DIR)" $(CRT_OBJ_DIR)
# per http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1189363&SiteID=1
$(foreach i,dll mt xdll xmt,$(EXTRACT_CMD))
# truly awful
#XXX: get ed into mozillabuild, bug 415123
$(PERL) $(srcdir)/apply-ed-patches.pl $(srcdir)/$(CRTDIFF) \
$(CRT_OBJ_DIR) $(srcdir)/ed.exe

$(MOZ_CRT_DLL): \
$(CRT_OBJ_DIR)/jemalloc.c $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h \
$(srcdir)/jemalloc_types.h $(srcdir)/rb.h
cp $(srcdir)/jemalloc.c $(srcdir)/jemalloc.h $(srcdir)/jemalloc_types.h $(srcdir)/rb.h \
$(CRT_OBJ_DIR)
# this pretty much sucks, but nmake and make don't play well together
$(PYTHON) $(srcdir)/build-crt.py $(CRT_OBJ_DIR)
# XXX: these don't link right for some reason; the problem is likely
# that not all the standard symbols are exported; looks like MSFT
# never updated the sample.def files; could probably fix if someone
# were ever bored enough. :-)
rm -f $(addsuffix .lib, $(addprefix $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/, $(MOZ_CRT_STATIC_LIBS)))
rm -f $(addsuffix .pdb, $(addprefix $(CRT_OBJ_DIR)/build/$(MOZ_CRT_CPU_ARCH)/, $(MOZ_CRT_STATIC_LIBS)))

# but still export jemalloc.h
EXPORTS = jemalloc.h jemalloc_types.h

else

CSRCS = jemalloc.c
EXPORTS = jemalloc.h jemalloc_types.h
LIBRARY_NAME = jemalloc

ifeq (WINNT,$(OS_TARGET))
FORCE_SHARED_LIB = 1

MOZ_MEMORY_LDFLAGS = # Don't link against ourselves
Expand All @@ -122,8 +63,6 @@ DEFFILE = $(srcdir)/jemalloc.def
LDFLAGS += -ENTRY:DllMain

NO_INSTALL_IMPORT_LIBRARY = 1

endif
else # Not Windows

ifeq ($(OS_ARCH),SunOS)
Expand All @@ -132,8 +71,6 @@ MODULE_OPTIMIZE_FLAGS = -xO5
endif
endif

LIBRARY_NAME = jemalloc

# Build jemalloc as a shared lib. This is mandatory for Darwin, since a library
# init function is used on that platform.
ifeq ($(OS_ARCH),Darwin)
Expand All @@ -143,9 +80,6 @@ DIST_INSTALL = 1
FORCE_STATIC_LIB= 1
endif

EXPORTS = jemalloc.h jemalloc_types.h
CSRCS = jemalloc.c

#XXX: PGO on Linux causes problems here
# See bug 419470
NO_PROFILE_GUIDED_OPTIMIZE = 1
Expand All @@ -162,8 +96,6 @@ LDFLAGS += -init _jemalloc_darwin_init
endif

ifeq (WINNT,$(OS_TARGET))
ifndef WIN32_OLD_STYLE_JEMALLOC

# Roll our own custom logic here for the import library

###############################################################################
Expand Down Expand Up @@ -240,6 +172,4 @@ crtdll.obj: msvc_combined.lib
# Grab both CRT libraries and combine them into one library to simplify things
msvc_combined.lib:
lib -OUT:$@ $(WIN32_CRT_LIBS)

endif
endif
84 changes: 0 additions & 84 deletions memory/jemalloc/apply-ed-patches.pl

This file was deleted.

20 changes: 0 additions & 20 deletions memory/jemalloc/build-crt.py

This file was deleted.

Loading

0 comments on commit 07abe0b

Please sign in to comment.