[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e4cd4a7 08/15: * src/alloc.c: Include "sheap.h".
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master e4cd4a7 08/15: * src/alloc.c: Include "sheap.h". |
Date: |
Sat, 30 Jan 2016 23:26:17 +0000 |
branch: master
commit e4cd4a76a621927bc155a18353ef7fd09133887d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
* src/alloc.c: Include "sheap.h".
(alloc_unexec_pre, alloc_unexec_post) [HYBRID_MALLOC]:
Set and clear bss_sbrk_did_unexec, on all platforms not just Cygwin.
* src/lisp.h (alloc_unexec_pre, alloc_unexec_post) [!DOUG_LEA_MALLOC]:
Declare unconditionally.
* src/unexcw.c, src/unexelf.c (bss_sbrk_did_unexec): Remove decl.
(unexec): Don’t set or clear bss_sbrk_did_unexec;
the caller now does this.
(Bug#22086)
---
src/alloc.c | 37 +++++++++++++++++++++++++------------
src/lisp.h | 5 -----
src/unexcw.c | 4 ----
src/unexelf.c | 8 --------
4 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index d379761..617148e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -35,6 +35,7 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include "dispextern.h"
#include "intervals.h"
#include "puresize.h"
+#include "sheap.h"
#include "systime.h"
#include "character.h"
#include "buffer.h"
@@ -117,18 +118,6 @@ my_heap_start (void)
inside glibc's malloc. */
static void *malloc_state_ptr;
-/* Get and free this pointer; useful around unexec. */
-void
-alloc_unexec_pre (void)
-{
- malloc_state_ptr = malloc_get_state ();
-}
-void
-alloc_unexec_post (void)
-{
- free (malloc_state_ptr);
-}
-
/* Restore the dumped malloc state. Because malloc can be invoked
even before main (e.g. by the dynamic linker), the dumped malloc
state must be restored as early as possible using this special hook. */
@@ -177,6 +166,30 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook
#endif
+/* Allocator-related actions to do just before and after unexec. */
+
+void
+alloc_unexec_pre (void)
+{
+#ifdef DOUG_LEA_MALLOC
+ malloc_state_ptr = malloc_get_state ();
+#endif
+#ifdef HYBRID_MALLOC
+ bss_sbrk_did_unexec = true;
+#endif
+}
+
+void
+alloc_unexec_post (void)
+{
+#ifdef DOUG_LEA_MALLOC
+ free (malloc_state_ptr);
+#endif
+#ifdef HYBRID_MALLOC
+ bss_sbrk_did_unexec = false;
+#endif
+}
+
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
diff --git a/src/lisp.h b/src/lisp.h
index 53f123d..3c8e3dd 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3602,13 +3602,8 @@ extern void mark_object (Lisp_Object);
#if defined REL_ALLOC && !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC
extern void refill_memory_reserve (void);
#endif
-#ifdef DOUG_LEA_MALLOC
extern void alloc_unexec_pre (void);
extern void alloc_unexec_post (void);
-#else
-INLINE void alloc_unexec_pre (void) {}
-INLINE void alloc_unexec_post (void) {}
-#endif
extern const char *pending_malloc_warning;
extern Lisp_Object zero_vector;
extern Lisp_Object *stack_base;
diff --git a/src/unexcw.c b/src/unexcw.c
index e4aa356..6ebd8c6 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -30,8 +30,6 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#define DOTEXE ".exe"
-extern int bss_sbrk_did_unexec;
-
/*
** header for Windows executable files
*/
@@ -298,9 +296,7 @@ unexec (const char *outfile, const char *infile)
ret = emacs_close (fd_in);
assert (ret == 0);
- bss_sbrk_did_unexec = 1;
fixup_executable (fd_out);
- bss_sbrk_did_unexec = 0;
ret = emacs_close (fd_out);
assert (ret == 0);
diff --git a/src/unexelf.c b/src/unexelf.c
index 3dc0456..e901994 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -211,10 +211,6 @@ entry_address (void *section_h, ptrdiff_t idx, ptrdiff_t
entsize)
typedef unsigned char byte;
-#ifdef HYBRID_MALLOC
-extern int bss_sbrk_did_unexec;
-#endif
-
/* ****************************************************************
* unexec
*
@@ -231,10 +227,6 @@ unexec (const char *new_name, const char *old_name)
off_t new_file_size;
void *new_break;
-#ifdef HYBRID_MALLOC
- bss_sbrk_did_unexec = 1;
-#endif
-
/* Pointers to the base of the image of the two files. */
caddr_t old_base, new_base;
- [Emacs-diffs] master updated (935b4d0 -> 692e410), Paul Eggert, 2016/01/30
- [Emacs-diffs] master dec1390 03/15: unexelf.c hook to support HYBRID_MALLOC on ELF, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 874c59a 06/15: Report static heap usage on non-Cygwin, too, Paul Eggert, 2016/01/30
- [Emacs-diffs] master a5f8586 02/15: Link temacs with gnulib compiled with -Demacs, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 384ffef 05/15: Pacify GCC on extern decls, Paul Eggert, 2016/01/30
- [Emacs-diffs] master d6585a9 04/15: Add musl patch to support HYBRID_MALLOC on elf systems, Paul Eggert, 2016/01/30
- [Emacs-diffs] master cb22fce 01/15: Internal linkage for gmalloc etc. if HYBRID_MALLOC, Paul Eggert, 2016/01/30
- [Emacs-diffs] master e4cd4a7 08/15: * src/alloc.c: Include "sheap.h".,
Paul Eggert <=
- [Emacs-diffs] master e1a9f20 07/15: Pacify --enable-gcc-warnings when HYBRID_MALLOC, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 2ee2963 12/15: Shrink static heap a bit, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 370a260 14/15: Make it easy to override preferred-branch test, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 3d82a8e 11/15: Fix extern symbols defined and not used, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 7fdc3cf 10/15: Build lib/e-*.o only on platforms that need it, Paul Eggert, 2016/01/30
- [Emacs-diffs] master a4817d8 09/15: Include <malloc.h> when advisable, Paul Eggert, 2016/01/30
- [Emacs-diffs] master 692e410 15/15: Tell Automake the new lib/Makefile.am is OK, Paul Eggert, 2016/01/30
- [Emacs-diffs] master ffbf163 13/15: ; Try to clean up ChangeLog.2 mess created by merge., Paul Eggert, 2016/01/30