aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf_post.h
diff options
context:
space:
mode:
authorKen Brown2014-08-28 10:48:02 -0400
committerKen Brown2014-08-28 10:48:02 -0400
commitea652500776aacbb8cb64f9ecca16a2d2c7add80 (patch)
treec759fc62dfa422e8fb636aef6dbb04df2c68cc7e /src/conf_post.h
parenta7ef7a0e53ae1f391f4bda207bb5e9b9d833d354 (diff)
downloademacs-ea652500776aacbb8cb64f9ecca16a2d2c7add80.tar.gz
emacs-ea652500776aacbb8cb64f9ecca16a2d2c7add80.zip
Add support for HYBRID_MALLOC, allowing the use of gmalloc before
dumping and the system malloc after dumping. (Bug#18222) * configure.ac (HYBRID_MALLOC): New macro; define to use gmalloc before dumping and the system malloc after dumping. Define on Cygwin. * src/conf_post.h (malloc, realloc, calloc, free) [HYBRID_MALLOC]: Define as macros, expanding to hybrid_malloc, etc. (HYBRID_GET_CURRENT_DIR_NAME): New macro. (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Define as macro. * src/gmalloc.c: Set up the infrastructure for HYBRID_MALLOC, with a full implementation on Cygwin. Remove Cygwin-specific code that is no longer needed. (malloc, realloc, calloc, free, aligned_alloc) [HYBRID_MALLOC]: Redefine as macros expanding to gmalloc, grealloc, etc. (DUMPED, ALLOCATED_BEFORE_DUMPING) [CYGWIN]: New macros. (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Undefine. (USE_PTHREAD, posix_memalign) [HYBRID_MALLOC]: Don't define. (hybrid_malloc, hybrid_calloc, hybrid_free, hybrid_realloc) [HYBRID_MALLOC]: (hybrid_get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: (hybrid_aligned_alloc) [HYBRID_MALLOC && (HAVE_ALIGNED_ALLOC || HAVE_POSIX_MEMALIGN)]: New functions. * src/alloc.c (aligned_alloc) [HYBRID_MALLOC && (ALIGNED_ALLOC || HAVE_POSIX_MEMALIGN)]: Define as macro expanding to hybrid_aligned_alloc; declare. (USE_ALIGNED_ALLOC) [HYBRID_MALLOC && (ALIGNED_ALLOC || HAVE_POSIX_MEMALIGN)]: Define. (refill_memory_reserve) [HYBRID_MALLOC]: Do nothing. * src/sysdep.c (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Define as macro, expanding to gget_current_dir_name, and define the latter. * src/emacs.c (main) [HYBRID_MALLOC]: Don't call memory_warnings() or malloc_enable_thread(). Don't initialize malloc. * src/lisp.h (NONPOINTER_BITS) [CYGWIN]: Define (because GNU_MALLOC is no longer defined on Cygwin). (refill_memory_reserve) [HYBRID_MALLOC]: Don't declare. * src/sheap.c (bss_sbrk_buffer_end): New variable. * src/unexcw.c (__malloc_initialized): Remove variable. * src/ralloc.c: Throughout, treat HYBRID_MALLOC the same as SYSTEM_MALLOC. * src/xdisp.c (decode_mode_spec) [HYBRID_MALLOC]: Don't check Vmemory_full.
Diffstat (limited to 'src/conf_post.h')
-rw-r--r--src/conf_post.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/conf_post.h b/src/conf_post.h
index c8e3672b228..35d9e6d1385 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -80,6 +80,23 @@ typedef bool bool_bf;
80#define vfork fork 80#define vfork fork
81#endif /* DARWIN_OS */ 81#endif /* DARWIN_OS */
82 82
83/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
84 gmalloc before dumping and the system malloc after dumping.
85 hybrid_malloc and friends, defined in gmalloc.c, are wrappers that
86 accomplish this. */
87#ifdef HYBRID_MALLOC
88#ifdef emacs
89#define malloc hybrid_malloc
90#define realloc hybrid_realloc
91#define calloc hybrid_calloc
92#define free hybrid_free
93#if defined HAVE_GET_CURRENT_DIR_NAME && !defined BROKEN_GET_CURRENT_DIR_NAME
94#define HYBRID_GET_CURRENT_DIR_NAME 1
95#define get_current_dir_name hybrid_get_current_dir_name
96#endif
97#endif
98#endif /* HYBRID_MALLOC */
99
83/* We have to go this route, rather than the old hpux9 approach of 100/* We have to go this route, rather than the old hpux9 approach of
84 renaming the functions via macros. The system's stdlib.h has fully 101 renaming the functions via macros. The system's stdlib.h has fully
85 prototyped declarations, which yields a conflicting definition of 102 prototyped declarations, which yields a conflicting definition of