diff options
| author | Paul Eggert | 2016-01-30 14:20:57 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-01-30 15:26:07 -0800 |
| commit | e4cd4a76a621927bc155a18353ef7fd09133887d (patch) | |
| tree | bdc6224d8cf108d37b82763dcfd629dea1c886e8 /src/alloc.c | |
| parent | e1a9f2099c2e683dffc4b898ce85ce935c4cb254 (diff) | |
| download | emacs-e4cd4a76a621927bc155a18353ef7fd09133887d.tar.gz emacs-e4cd4a76a621927bc155a18353ef7fd09133887d.zip | |
* 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)
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/alloc.c b/src/alloc.c index d379761c168..617148e85e5 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/>. */ | |||
| 35 | #include "dispextern.h" | 35 | #include "dispextern.h" |
| 36 | #include "intervals.h" | 36 | #include "intervals.h" |
| 37 | #include "puresize.h" | 37 | #include "puresize.h" |
| 38 | #include "sheap.h" | ||
| 38 | #include "systime.h" | 39 | #include "systime.h" |
| 39 | #include "character.h" | 40 | #include "character.h" |
| 40 | #include "buffer.h" | 41 | #include "buffer.h" |
| @@ -117,18 +118,6 @@ my_heap_start (void) | |||
| 117 | inside glibc's malloc. */ | 118 | inside glibc's malloc. */ |
| 118 | static void *malloc_state_ptr; | 119 | static void *malloc_state_ptr; |
| 119 | 120 | ||
| 120 | /* Get and free this pointer; useful around unexec. */ | ||
| 121 | void | ||
| 122 | alloc_unexec_pre (void) | ||
| 123 | { | ||
| 124 | malloc_state_ptr = malloc_get_state (); | ||
| 125 | } | ||
| 126 | void | ||
| 127 | alloc_unexec_post (void) | ||
| 128 | { | ||
| 129 | free (malloc_state_ptr); | ||
| 130 | } | ||
| 131 | |||
| 132 | /* Restore the dumped malloc state. Because malloc can be invoked | 121 | /* Restore the dumped malloc state. Because malloc can be invoked |
| 133 | even before main (e.g. by the dynamic linker), the dumped malloc | 122 | even before main (e.g. by the dynamic linker), the dumped malloc |
| 134 | state must be restored as early as possible using this special hook. */ | 123 | state must be restored as early as possible using this special hook. */ |
| @@ -177,6 +166,30 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook | |||
| 177 | 166 | ||
| 178 | #endif | 167 | #endif |
| 179 | 168 | ||
| 169 | /* Allocator-related actions to do just before and after unexec. */ | ||
| 170 | |||
| 171 | void | ||
| 172 | alloc_unexec_pre (void) | ||
| 173 | { | ||
| 174 | #ifdef DOUG_LEA_MALLOC | ||
| 175 | malloc_state_ptr = malloc_get_state (); | ||
| 176 | #endif | ||
| 177 | #ifdef HYBRID_MALLOC | ||
| 178 | bss_sbrk_did_unexec = true; | ||
| 179 | #endif | ||
| 180 | } | ||
| 181 | |||
| 182 | void | ||
| 183 | alloc_unexec_post (void) | ||
| 184 | { | ||
| 185 | #ifdef DOUG_LEA_MALLOC | ||
| 186 | free (malloc_state_ptr); | ||
| 187 | #endif | ||
| 188 | #ifdef HYBRID_MALLOC | ||
| 189 | bss_sbrk_did_unexec = false; | ||
| 190 | #endif | ||
| 191 | } | ||
| 192 | |||
| 180 | /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer | 193 | /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer |
| 181 | to a struct Lisp_String. */ | 194 | to a struct Lisp_String. */ |
| 182 | 195 | ||