aboutsummaryrefslogtreecommitdiffstats
path: root/nt
diff options
context:
space:
mode:
authorFabrice Popineau2014-05-27 20:31:17 +0300
committerEli Zaretskii2014-05-27 20:31:17 +0300
commit587fd086a045f715932f886ecf31015932464ce6 (patch)
treed8c647af107ef94318fd920a05da09af654ef1c9 /nt
parent0da7d35c6754b44d1ef4383e4a8ba9b98afc3a4c (diff)
downloademacs-587fd086a045f715932f886ecf31015932464ce6.tar.gz
emacs-587fd086a045f715932f886ecf31015932464ce6.zip
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/ChangeLog9
-rw-r--r--nt/INSTALL21
-rw-r--r--nt/inc/ms-w32.h33
-rw-r--r--nt/inc/sys/mman.h31
4 files changed, 78 insertions, 16 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index a3cb5e62dac..961de329ad5 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,12 @@
12014-05-27 Fabrice Popineau <fabrice.popineau@gmail.com>
2
3 * inc/ms-w32.h: Switch to the system heap allocation scheme
4 instead of GNU malloc and ralloc.
5
6 * inc/sys/mman.h: New file.
7
8 * INSTALL: Update for the new build requirements.
9
12014-05-17 Paul Eggert <eggert@cs.ucla.edu> 102014-05-17 Paul Eggert <eggert@cs.ucla.edu>
2 11
3 Assume C99 or later (Bug#17487). 12 Assume C99 or later (Bug#17487).
diff --git a/nt/INSTALL b/nt/INSTALL
index 949a4e452cf..4ecf4da3181 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -5,9 +5,9 @@
5 See the end of the file for license conditions. 5 See the end of the file for license conditions.
6 6
7The MSYS/MinGW build described here is supported on versions of 7The MSYS/MinGW build described here is supported on versions of
8Windows starting with Windows 2000 and newer. Windows 9X are not 8Windows starting with Windows XP and newer. Building on Windows 2000
9supported (but the Emacs binary produced by this build will run on 9and Windows 9X is not supported (but the Emacs binary produced by this
10Windows 9X as well). 10build will run on Windows 9X and newer systems).
11 11
12 Do not use this recipe with Cygwin. For building on Cygwin, use the 12 Do not use this recipe with Cygwin. For building on Cygwin, use the
13 normal installation instructions, ../INSTALL. 13 normal installation instructions, ../INSTALL.
@@ -389,9 +389,10 @@ Windows 9X as well).
389 389
390 Where should the build process find the source code? /path/to/emacs/sources 390 Where should the build process find the source code? /path/to/emacs/sources
391 What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3 391 What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3
392 Should Emacs use the GNU version of malloc? yes 392 Should Emacs use the GNU version of malloc? no
393 Should Emacs use a relocating allocator for buffers? yes 393 (The GNU allocators don't work with this system configuration.)
394 Should Emacs use mmap(2) for buffer allocation? no 394 Should Emacs use a relocating allocator for buffers? no
395 Should Emacs use mmap(2) for buffer allocation? yes
395 What window system should Emacs use? w32 396 What window system should Emacs use? w32
396 What toolkit should Emacs use? none 397 What toolkit should Emacs use? none
397 Where do we find X Windows header files? NONE 398 Where do we find X Windows header files? NONE
@@ -401,13 +402,16 @@ Windows 9X as well).
401 Does Emacs use -ljpeg? yes 402 Does Emacs use -ljpeg? yes
402 Does Emacs use -ltiff? yes 403 Does Emacs use -ltiff? yes
403 Does Emacs use a gif library? yes 404 Does Emacs use a gif library? yes
404 Does Emacs use -lpng? yes 405 Does Emacs use a png library? yes
405 Does Emacs use -lrsvg-2? no 406 Does Emacs use -lrsvg-2? yes
406 Does Emacs use imagemagick? no 407 Does Emacs use imagemagick? no
408 Does Emacs support sound? no
407 Does Emacs use -lgpm? no 409 Does Emacs use -lgpm? no
408 Does Emacs use -ldbus? no 410 Does Emacs use -ldbus? no
409 Does Emacs use -lgconf? no 411 Does Emacs use -lgconf? no
410 Does Emacs use GSettings? no 412 Does Emacs use GSettings? no
413 Does Emacs use a file notification library? yes (w32)
414 Does Emacs use access control lists? yes
411 Does Emacs use -lselinux? no 415 Does Emacs use -lselinux? no
412 Does Emacs use -lgnutls? yes 416 Does Emacs use -lgnutls? yes
413 Does Emacs use -lxml2? yes 417 Does Emacs use -lxml2? yes
@@ -415,6 +419,7 @@ Windows 9X as well).
415 Does Emacs use -lm17n-flt? no 419 Does Emacs use -lm17n-flt? no
416 Does Emacs use -lotf? no 420 Does Emacs use -lotf? no
417 Does Emacs use -lxft? no 421 Does Emacs use -lxft? no
422 Does Emacs directly use zlib? yes
418 Does Emacs use toolkit scroll bars? yes 423 Does Emacs use toolkit scroll bars? yes
419 424
420 You are almost there, hang on. 425 You are almost there, hang on.
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 8f7c36ab1ee..1cf78bac83a 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -140,6 +140,7 @@ extern char *getenv ();
140 in its system headers, and is not really compatible with values 140 in its system headers, and is not really compatible with values
141 lower than 0x0500, so leave it alone. */ 141 lower than 0x0500, so leave it alone. */
142#ifndef _W64 142#ifndef _W64
143# undef _WIN32_WINNT
143# define _WIN32_WINNT 0x0400 144# define _WIN32_WINNT 0x0400
144#endif 145#endif
145 146
@@ -427,20 +428,36 @@ extern char *get_emacs_configuration_options (void);
427#define _WINSOCK_H 428#define _WINSOCK_H
428 429
429/* Defines size_t and alloca (). */ 430/* Defines size_t and alloca (). */
430#ifdef emacs 431#include <stdlib.h>
431#define malloc e_malloc 432#include <sys/stat.h>
432#define free e_free
433#define realloc e_realloc
434#define calloc e_calloc
435#endif
436#ifdef _MSC_VER 433#ifdef _MSC_VER
437#define alloca _alloca 434#define alloca _alloca
438#else 435#else
439#include <malloc.h> 436#include <malloc.h>
440#endif 437#endif
441 438
442#include <stdlib.h> 439#ifdef emacs
443#include <sys/stat.h> 440
441typedef void * (* malloc_fn)(size_t);
442typedef void * (* realloc_fn)(void *, size_t);
443typedef void (* free_fn)(void *);
444
445extern void *malloc_before_dump(size_t);
446extern void *realloc_before_dump(void *, size_t);
447extern void free_before_dump(void *);
448extern void *malloc_after_dump(size_t);
449extern void *realloc_after_dump(void *, size_t);
450extern void free_after_dump(void *);
451
452extern malloc_fn the_malloc_fn;
453extern realloc_fn the_realloc_fn;
454extern free_fn the_free_fn;
455
456#define malloc(size) (*the_malloc_fn)(size)
457#define free(ptr) (*the_free_fn)(ptr)
458#define realloc(ptr, size) (*the_realloc_fn)(ptr, size)
459
460#endif
444 461
445/* Define for those source files that do not include enough NT system files. */ 462/* Define for those source files that do not include enough NT system files. */
446#ifndef NULL 463#ifndef NULL
diff --git a/nt/inc/sys/mman.h b/nt/inc/sys/mman.h
new file mode 100644
index 00000000000..6990edcb59b
--- /dev/null
+++ b/nt/inc/sys/mman.h
@@ -0,0 +1,31 @@
1/*
2 * sys/mman.h
3 * mman-win32
4 */
5
6#ifndef _SYS_MMAN_H_
7#define _SYS_MMAN_H_
8
9#include <sys/types.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/* We need MAP_ANON in src/buffer.c */
16
17#define MAP_FILE 0
18#define MAP_SHARED 1
19#define MAP_PRIVATE 2
20#define MAP_TYPE 0xf
21#define MAP_FIXED 0x10
22#define MAP_ANONYMOUS 0x20
23#define MAP_ANON MAP_ANONYMOUS
24
25#define MAP_FAILED ((void *)-1)
26
27#ifdef __cplusplus
28};
29#endif
30
31#endif /* _SYS_MMAN_H_ */