aboutsummaryrefslogtreecommitdiffstats
path: root/nt/inc
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/inc
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/inc')
-rw-r--r--nt/inc/ms-w32.h33
-rw-r--r--nt/inc/sys/mman.h31
2 files changed, 56 insertions, 8 deletions
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_ */