diff options
author | Fabrice Popineau <[email protected]> | 2014-05-27 20:31:17 +0300 |
---|---|---|
committer | Eli Zaretskii <[email protected]> | 2014-05-27 20:31:17 +0300 |
commit | 587fd086a045f715932f886ecf31015932464ce6 (patch) | |
tree | d8c647af107ef94318fd920a05da09af654ef1c9 /nt | |
parent | 0da7d35c6754b44d1ef4383e4a8ba9b98afc3a4c (diff) |
Use mmap(2) emulation for buffer text on MS-Windows.
src/Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
configure.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
src/lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
for MinGW, since it no longer uses gmalloc.
src/buffer.c: Do not define mmap allocations functions for Windows.
Remove mmap_find which is unused. Remove mmap_set_vars which does
nothing useful.
[WINDOWSNT]: Include w32heap.h.
(init_buffer): Always allocate new memory for buffers.
src/emacs.c: Remove mmap_set_vars calls.
src/image.c (free_image): Undef free for Windows because it is
redirected to our private version.
src/unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
compatibility.
(copy_executable_and_dump_data): Remove dumping the heap section.
(unexec): Restore using_dynamic_heap after dumping.
src/w32heap.c (dumped_data_commit, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
(mmap_free): New functions.
src/w32heap.h: Declare dumped_data and mmap_* function prototypes.
nt/inc/ms-w32.h: Switch to the system heap allocation scheme
instead of GNU malloc and ralloc.
nt/inc/sys/mman.h: New file.
nt/INSTALL: Update for the new build requirements.
etc/NEWS: Mention build changes on MS-Windows.
configure.ac (C_HEAP_SWITCH) define for different values of
dumped heap size depending on 32/64bits arch on Windows.
Don't check for pthreads.h on MinGW32/64, it gets in the way.
Use mmap(2) for buffers and system malloc for MinGW32/64.
Diffstat (limited to 'nt')
-rw-r--r-- | nt/ChangeLog | 9 | ||||
-rw-r--r-- | nt/INSTALL | 21 | ||||
-rw-r--r-- | nt/inc/ms-w32.h | 33 | ||||
-rw-r--r-- | nt/inc/sys/mman.h | 31 |
4 files changed, 78 insertions, 16 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index a3cb5e62da..961de329ad 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,12 @@ +2014-05-27 Fabrice Popineau <[email protected]> + + * inc/ms-w32.h: Switch to the system heap allocation scheme + instead of GNU malloc and ralloc. + + * inc/sys/mman.h: New file. + + * INSTALL: Update for the new build requirements. + 2014-05-17 Paul Eggert <[email protected]> Assume C99 or later (Bug#17487). diff --git a/nt/INSTALL b/nt/INSTALL index 949a4e452c..4ecf4da318 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -5,9 +5,9 @@ See the end of the file for license conditions. The MSYS/MinGW build described here is supported on versions of -Windows starting with Windows 2000 and newer. Windows 9X are not -supported (but the Emacs binary produced by this build will run on -Windows 9X as well). +Windows starting with Windows XP and newer. Building on Windows 2000 +and Windows 9X is not supported (but the Emacs binary produced by this +build will run on Windows 9X and newer systems). Do not use this recipe with Cygwin. For building on Cygwin, use the normal installation instructions, ../INSTALL. @@ -389,9 +389,10 @@ Windows 9X as well). Where should the build process find the source code? /path/to/emacs/sources What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3 - Should Emacs use the GNU version of malloc? yes - Should Emacs use a relocating allocator for buffers? yes - Should Emacs use mmap(2) for buffer allocation? no + Should Emacs use the GNU version of malloc? no + (The GNU allocators don't work with this system configuration.) + Should Emacs use a relocating allocator for buffers? no + Should Emacs use mmap(2) for buffer allocation? yes What window system should Emacs use? w32 What toolkit should Emacs use? none Where do we find X Windows header files? NONE @@ -401,13 +402,16 @@ Windows 9X as well). Does Emacs use -ljpeg? yes Does Emacs use -ltiff? yes Does Emacs use a gif library? yes - Does Emacs use -lpng? yes - Does Emacs use -lrsvg-2? no + Does Emacs use a png library? yes + Does Emacs use -lrsvg-2? yes Does Emacs use imagemagick? no + Does Emacs support sound? no Does Emacs use -lgpm? no Does Emacs use -ldbus? no Does Emacs use -lgconf? no Does Emacs use GSettings? no + Does Emacs use a file notification library? yes (w32) + Does Emacs use access control lists? yes Does Emacs use -lselinux? no Does Emacs use -lgnutls? yes Does Emacs use -lxml2? yes @@ -415,6 +419,7 @@ Windows 9X as well). Does Emacs use -lm17n-flt? no Does Emacs use -lotf? no Does Emacs use -lxft? no + Does Emacs directly use zlib? yes Does Emacs use toolkit scroll bars? yes You are almost there, hang on. diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 8f7c36ab1e..1cf78bac83 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -140,6 +140,7 @@ extern char *getenv (); in its system headers, and is not really compatible with values lower than 0x0500, so leave it alone. */ #ifndef _W64 +# undef _WIN32_WINNT # define _WIN32_WINNT 0x0400 #endif @@ -427,20 +428,36 @@ extern char *get_emacs_configuration_options (void); #define _WINSOCK_H /* Defines size_t and alloca (). */ -#ifdef emacs -#define malloc e_malloc -#define free e_free -#define realloc e_realloc -#define calloc e_calloc -#endif +#include <stdlib.h> +#include <sys/stat.h> #ifdef _MSC_VER #define alloca _alloca #else #include <malloc.h> #endif -#include <stdlib.h> -#include <sys/stat.h> +#ifdef emacs + +typedef void * (* malloc_fn)(size_t); +typedef void * (* realloc_fn)(void *, size_t); +typedef void (* free_fn)(void *); + +extern void *malloc_before_dump(size_t); +extern void *realloc_before_dump(void *, size_t); +extern void free_before_dump(void *); +extern void *malloc_after_dump(size_t); +extern void *realloc_after_dump(void *, size_t); +extern void free_after_dump(void *); + +extern malloc_fn the_malloc_fn; +extern realloc_fn the_realloc_fn; +extern free_fn the_free_fn; + +#define malloc(size) (*the_malloc_fn)(size) +#define free(ptr) (*the_free_fn)(ptr) +#define realloc(ptr, size) (*the_realloc_fn)(ptr, size) + +#endif /* Define for those source files that do not include enough NT system files. */ #ifndef NULL diff --git a/nt/inc/sys/mman.h b/nt/inc/sys/mman.h new file mode 100644 index 0000000000..6990edcb59 --- /dev/null +++ b/nt/inc/sys/mman.h @@ -0,0 +1,31 @@ +/* + * sys/mman.h + * mman-win32 + */ + +#ifndef _SYS_MMAN_H_ +#define _SYS_MMAN_H_ + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* We need MAP_ANON in src/buffer.c */ + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xf +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +#define MAP_FAILED ((void *)-1) + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_MMAN_H_ */ |