Bug 521193 - jemalloc support for Windows x64 build (VC 2005 / 2008). r=ted

--HG--
rename : memory/jemalloc/crtvc8sp1.diff => memory/jemalloc/crtvc8sp1-intel.diff
rename : memory/jemalloc/crtvc9sp1.diff => memory/jemalloc/crtvc9sp1-intel.diff
This commit is contained in:
Makoto Kato 2010-06-03 19:12:26 +09:00
Родитель a8302f630d
Коммит 4bfdde6d45
7 изменённых файлов: 502 добавлений и 11 удалений

Просмотреть файл

@ -596,6 +596,7 @@ MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
WIN32_REDIST_DIR = @WIN32_REDIST_DIR@
WIN32_CRT_SRC_DIR = @WIN32_CRT_SRC_DIR@
MOZ_MEMORY_LDFLAGS = @MOZ_MEMORY_LDFLAGS@
MOZ_CRT_CPU_ARCH = @MOZ_CRT_CPU_ARCH@
# This is for custom CRT building
ifdef MOZ_MEMORY

Просмотреть файл

@ -7227,19 +7227,24 @@ if test "$MOZ_MEMORY"; then
dnl cpu check
case "${target_cpu}" in
i*86)
_WIN32_CRT_CPU=intel
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)
if test ! -d "$WIN32_CRT_SRC_DIR"; then
AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
fi
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/$_WIN32_CRT_CPU"
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"
dnl Also pass this to NSPR/NSS
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"

Просмотреть файл

@ -55,10 +55,10 @@ 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/intel/$(MOZ_CRT_DLL_NAME).dll
MOZ_CRT_IMPORT_LIB = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRT_DLL_NAME).lib
MOZ_CRTCPP_DLL = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRTCPP_DLL_NAME).dll
MOZ_CRTCPP_IMPORT_LIB = $(CRT_OBJ_DIR)/build/intel/$(MOZ_CRTCPP_DLL_NAME).lib
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
@ -69,15 +69,15 @@ libs:: $(MOZ_CRT_DLL) $(MOZ_CRT_IMPORT_LIB)
$(MOZ_CRT_IMPORT_LIB): $(MOZ_CRT_DLL)
define EXTRACT_CMD
cd $(CRT_OBJ_DIR)/intel/$(i)_lib && lib "-extract:..\\build\\intel\\$(i)_obj\\unhandld.obj" eh.lib
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.diff
CRTDIFF=crtvc8sp1-$(MOZ_CRT_CPU_ARCH).diff
else
CRTDIFF=crtvc9sp1.diff
CRTDIFF=crtvc9sp1-$(MOZ_CRT_CPU_ARCH).diff
endif
$(CRT_OBJ_DIR)/jemalloc.c: $(srcdir)/$(CRTDIFF)
@ -101,8 +101,8 @@ $(MOZ_CRT_DLL): \
# 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/intel/, $(MOZ_CRT_STATIC_LIBS)))
rm -f $(addsuffix .pdb, $(addprefix $(CRT_OBJ_DIR)/build/intel/, $(MOZ_CRT_STATIC_LIBS)))
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

Просмотреть файл

@ -0,0 +1,235 @@
diff -re crt/src/AMD64/_sample_.def crtsrc/AMD64/_sample_.def
1160d
717,718d
663a
posix_memalign
.
637a
memalign
.
494a
malloc_usable_size
jemalloc_stats
.
330,335d
318d
307,308d
75d
9c
LIBRARY MOZCRT19
.
diff -re crt/src/_sample_.rc crtsrc/_sample_.rc
41c
VALUE "ProductName", "Mozilla Custom C Runtime"
.
39c
VALUE "OriginalFilename", "MOZCRT19.DLL"
.
37c
VALUE "OriginalFilename", "MOZCRT19D.DLL"
.
33c
VALUE "InternalName", "MOZCRT19.DLL"
.
31c
VALUE "InternalName", "MOZCRT19D.DLL"
.
27c
VALUE "CompanyName", "Mozilla Foundation"
.
Only in crtsrc/: build
diff -re crt/src/crt0.c crtsrc/crt0.c
273c
/*
* this used to happen in _mtinit, but we need it before malloc
*/
_init_pointers(); /* initialize global function pointers */
if ( malloc_init_hard() ) /* initialize heap */
.
101a
extern BOOL malloc_init_hard(void);
.
diff -re crt/src/crt0dat.c crtsrc/crt0dat.c
789d
778d
diff -re crt/src/crtexe.c crtsrc/crtexe.c
333,335d
diff -re crt/src/crtheap.c crtsrc/crtheap.c
61c
pv = calloc(count, size);
.
58,59d
diff -re crt/src/crtlib.c crtsrc/crtlib.c
781,788d
416d
400a
malloc_shutdown();
.
359d
340d
310,311d
300d
287c
/*
* this used to happen in _mtinit, but we need it before malloc
*/
_init_pointers(); /* initialize global function pointers */
if ( malloc_init_hard() ) /* initialize heap */
.
43a
extern BOOL malloc_init_hard(void);
extern void malloc_shutdown(void);
.
diff -re crt/src/dllcrt0.c crtsrc/dllcrt0.c
236,237d
183d
173d
158d
153,155d
diff -re crt/src/gs_report.c crtsrc/gs_report.c
23,41d
diff -re crt/src/internal.h crtsrc/internal.h
407a
#endif
.
403a
#if 0
.
diff -re crt/src/invarg.c crtsrc/invarg.c
103a
VOID NTAPI RtlCaptureContext (PCONTEXT ContextRecord);
.
diff -re crt/src/makefile crtsrc/makefile
1840c
-def:$(DEFFILE2_DIR)\sample_p.def
.
1816c
$(DEFFILE2_DIR)\sample_p.def $(CPPSRC_OBJS_DLL:*=dll) \
.
1745a
$(DEFFILE_DIR)\$(RETAIL_LIB_NAME).def : $(DEFFILE_DIR)\_sample_.def
copy $** $@
.
1274d
1228,1230d
754c
dll_ :: $(OBJROOT) $(OBJCPUDIR) $(OBJDIR_DLL) $(OBJDIR_DLL)\$(PURE_OBJ_DIR) \
$(OBJDIR_DLL)\$(CPP_OBJ_DIR) \
$(RELDIR_CPU) $(PDBDIR_CPU_DLL) $(MAKE_DIRS_DLL)
.
334c
CC_OPTS_BASE=-c -nologo -Zlp8 -W3 -GFy -DWIND32
.
307,309c
LINKER=link
LINKLIB=link -lib
LINKIMPLIB=link -lib
.
302,304c
LINKER=link -nologo
LINKLIB=link -lib -nologo
LINKIMPLIB=link -lib -nologo
.
209d
21,24c
RETAIL_DLL_NAME=MOZCRT19
RETAIL_LIB_NAME=mozcrt19
RETAIL_DLLCPP_NAME=MOZCPP19
RETAIL_LIBCPP_NAME=mozcpp19
.
diff -re crt/src/makefile.inc crtsrc/makefile.inc
1624a
$(OBJDIR)\unhandld.obj: $(PREOBJDIR)\unhandld.obj
copy $(PREOBJDIR)\unhandld.obj $@
.
1134a
$(OBJDIR)\memmove.obj \
.
618d
402d
342,353c
$(OBJDIR)\jemalloc.obj \
.
334,335d
329,330d
327d
323d
320d
diff -re crt/src/makefile.sub crtsrc/makefile.sub
103c
LIB=link -lib -nologo
.
69c
CFLAGS=$(CFLAGS) -O2 -DMOZ_MEMORY=1 -DMOZ_MEMORY_WINDOWS=1
.
67c
CFLAGS=$(CFLAGS) -O2 -DMOZ_MEMORY=1 -DMOZ_MEMORY_WINDOWS=1
.
diff -re crt/src/malloc.h crtsrc/malloc.h
189a
#endif
.
177a
#if 0
.
161d
83a
#endif
.
70a
#if 0
.
diff -re crt/src/mlock.c crtsrc/mlock.c
274c
#endif
.
262a
#if 0
.
diff -re crt/src/new.cpp crtsrc/new.cpp
60d
52,55d
37,38c
break;
.
diff -re crt/src/nothrownew.cpp crtsrc/nothrownew.cpp
37a
#endif
.
31a
#if 1
break;
#else
.
diff -re crt/src/sample_p.def crtsrc/sample_p.def
8c
LIBRARY MOZCPP19
.
diff -re crt/src/sample_p.rc crtsrc/sample_p.rc
41c
VALUE "ProductName", "Mozilla Custom C++ Runtime"
.
39c
VALUE "OriginalFilename", "MOZCPP19.DLL"
.
37c
VALUE "OriginalFilename", "MOZCPP19D.DLL"
.
33c
VALUE "InternalName", "MOZCPP19.DLL"
.
31c
VALUE "InternalName", "MOZCPP19D.DLL"
.
27c
VALUE "CompanyName", "Mozilla Foundation"
.
diff -re crt/src/tidtable.c crtsrc/tidtable.c
393,394d

Просмотреть файл

Просмотреть файл

@ -0,0 +1,250 @@
diff -re crt/src/AMD64/_sample_.def crtsrc/AMD64/_sample_.def
1150d
712,713d
658a
posix_memalign
.
632a
memalign
.
489a
malloc_usable_size
.
461a
jemalloc_stats
.
325,330d
313d
307,308d
75d
9c
LIBRARY MOZCRT19
.
diff -re crt/src/_sample_.rc crtsrc/_sample_.rc
41c
VALUE "ProductName", "Mozilla Custom C Runtime"
.
39c
VALUE "OriginalFilename", "MOZCRT19.DLL"
.
37c
VALUE "OriginalFilename", "MOZCRT19D.DLL"
.
33c
VALUE "InternalName", "MOZCRT19.DLL"
.
31c
VALUE "InternalName", "MOZCRT19D.DLL"
.
27c
VALUE "CompanyName", "Mozilla Foundation"
.
diff -re crt/src/crt0.c crtsrc/crt0.c
212c
/*
* this used to happen in _mtinit, but we need it before malloc
*/
_init_pointers(); /* initialize global function pointers */
if ( malloc_init_hard() ) /* initialize heap */
.
87a
extern BOOL malloc_init_hard(void);
.
diff -re crt/src/crt0dat.c crtsrc/crt0dat.c
837d
826d
diff -re crt/src/crtdll.c crtsrc/crtdll.c
31,40d
diff -re crt/src/crtexe.c crtsrc/crtexe.c
322,324d
35,45d
diff -re crt/src/crtheap.c crtsrc/crtheap.c
61c
pv = calloc(count, size);
.
58,59d
diff -re crt/src/crtlib.c crtsrc/crtlib.c
686,693d
355d
339a
malloc_shutdown();
.
298d
279d
249,250d
239d
226c
/*
* this used to happen in _mtinit, but we need it before malloc
*/
_init_pointers(); /* initialize global function pointers */
if ( malloc_init_hard() ) /* initialize heap */
.
43a
extern BOOL malloc_init_hard(void);
extern void malloc_shutdown(void);
.
diff -re crt/src/dllcrt0.c crtsrc/dllcrt0.c
189,190d
136d
126d
111d
106,108d
diff -re crt/src/gs_report.c crtsrc/gs_report.c
41c
#endif
.
22c
#if 0
.
diff -re crt/src/intel/_sample_.def crtsrc/intel/_sample_.def
1198d
718,719d
664a
posix_memalign
.
638a
memalign
.
495a
malloc_usable_size
.
467a
jemalloc_stats
.
331,336d
319d
313,314d
81d
9c
LIBRARY MOZCRT19
.
diff -re crt/src/internal.h crtsrc/internal.h
413a
#endif
.
409c
#if 0
.
diff -re crt/src/invarg.c crtsrc/invarg.c
53c
#endif
.
34c
#if 0
.
diff -re crt/src/makefile crtsrc/makefile
1873c
-def:$(DEFFILE2_DIR)\sample_p.def
.
1841c
$(DEFFILE2_DIR)\sample_p.def $(CPPSRC_OBJS_DLL:*=dll) \
.
1771a
$(DEFFILE_DIR)\$(RETAIL_LIB_NAME).def : $(DEFFILE_DIR)\_sample_.def
copy $** $@
.
1290d
1235,1237d
760c
dll_ :: $(OBJROOT) $(OBJCPUDIR) $(OBJDIR_DLL) $(OBJDIR_DLL)\$(PURE_OBJ_DIR) \
$(OBJDIR_DLL)\$(CPP_OBJ_DIR) \
$(RELDIR_CPU) $(PDBDIR_CPU_DLL) $(MAKE_DIRS_DLL)
.
340c
CC_OPTS_BASE=-c -nologo -Zlp8 -W3 -GFy -DWIND32
.
213d
21,24c
RETAIL_DLL_NAME=MOZCRT19
RETAIL_LIB_NAME=mozcrt19
RETAIL_DLLCPP_NAME=MOZCPP19
RETAIL_LIBCPP_NAME=mozcpp19
.
diff -re crt/src/makefile.inc crtsrc/makefile.inc
1636a
$(OBJDIR)\unhandld.obj: $(PREOBJDIR)\unhandld.obj
copy $(PREOBJDIR)\unhandld.obj $@
.
623d
621d
405d
344,356c
$(OBJDIR)\jemalloc.obj \
.
336,337d
331,332d
329d
325d
321,322d
diff -re crt/src/makefile.sub crtsrc/makefile.sub
66c
CFLAGS=$(CFLAGS) -O2 -DMOZ_MEMORY=1 -DMOZ_MEMORY_WINDOWS=1
.
diff -re crt/src/malloc.h crtsrc/malloc.h
189a
#endif
.
177a
#if 0
.
83a
#endif
.
70a
#if 0
.
diff -re crt/src/mlock.c crtsrc/mlock.c
274c
#endif
.
262a
#if 0
.
diff -re crt/src/new.cpp crtsrc/new.cpp
60d
52,55d
37,38c
break;
.
diff -re crt/src/nothrownew.cpp crtsrc/nothrownew.cpp
38c
#endif
.
31a
#if 1
break;
#else
.
diff -re crt/src/sample_p.def crtsrc/sample_p.def
8c
LIBRARY mozcpp19
.
diff -re crt/src/sample_p.rc crtsrc/sample_p.rc
41c
VALUE "ProductName", "Mozilla Custom C++ Runtime"
.
39c
VALUE "OriginalFilename", "MOZCPP19.DLL"
.
37c
VALUE "OriginalFilename", "MOZCPP19D.DLL"
.
33c
VALUE "InternalName", "MOZCPP19.DLL"
.
31c
VALUE "InternalName", "MOZCPP19D.DLL"
.
27c
VALUE "CompanyName", "Mozilla Foundation"
.
diff -re crt/src/tidtable.c crtsrc/tidtable.c
360,361d

Просмотреть файл