diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 115 |
1 files changed, 63 insertions, 52 deletions
diff --git a/src/alloc.c b/src/alloc.c index 522f33f5379..188a514376d 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -69,6 +69,9 @@ extern void *sbrk (); | |||
| 69 | 69 | ||
| 70 | #include <fcntl.h> | 70 | #include <fcntl.h> |
| 71 | 71 | ||
| 72 | #ifdef USE_GTK | ||
| 73 | # include "gtkutil.h" | ||
| 74 | #endif | ||
| 72 | #ifdef WINDOWSNT | 75 | #ifdef WINDOWSNT |
| 73 | #include "w32.h" | 76 | #include "w32.h" |
| 74 | #endif | 77 | #endif |
| @@ -173,15 +176,15 @@ EMACS_INT gc_relative_threshold; | |||
| 173 | 176 | ||
| 174 | EMACS_INT memory_full_cons_threshold; | 177 | EMACS_INT memory_full_cons_threshold; |
| 175 | 178 | ||
| 176 | /* Nonzero during GC. */ | 179 | /* True during GC. */ |
| 177 | 180 | ||
| 178 | int gc_in_progress; | 181 | bool gc_in_progress; |
| 179 | 182 | ||
| 180 | /* Nonzero means abort if try to GC. | 183 | /* True means abort if try to GC. |
| 181 | This is for code which is written on the assumption that | 184 | This is for code which is written on the assumption that |
| 182 | no GC will happen, so as to verify that assumption. */ | 185 | no GC will happen, so as to verify that assumption. */ |
| 183 | 186 | ||
| 184 | int abort_on_gc; | 187 | bool abort_on_gc; |
| 185 | 188 | ||
| 186 | /* Number of live and free conses etc. */ | 189 | /* Number of live and free conses etc. */ |
| 187 | 190 | ||
| @@ -223,7 +226,7 @@ static ptrdiff_t pure_size; | |||
| 223 | 226 | ||
| 224 | static ptrdiff_t pure_bytes_used_before_overflow; | 227 | static ptrdiff_t pure_bytes_used_before_overflow; |
| 225 | 228 | ||
| 226 | /* Value is non-zero if P points into pure space. */ | 229 | /* True if P points into pure space. */ |
| 227 | 230 | ||
| 228 | #define PURE_POINTER_P(P) \ | 231 | #define PURE_POINTER_P(P) \ |
| 229 | ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size) | 232 | ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size) |
| @@ -305,7 +308,9 @@ enum mem_type | |||
| 305 | and runtime slowdown. Minor but pointless. */ | 308 | and runtime slowdown. Minor but pointless. */ |
| 306 | MEM_TYPE_VECTORLIKE, | 309 | MEM_TYPE_VECTORLIKE, |
| 307 | /* Special type to denote vector blocks. */ | 310 | /* Special type to denote vector blocks. */ |
| 308 | MEM_TYPE_VECTOR_BLOCK | 311 | MEM_TYPE_VECTOR_BLOCK, |
| 312 | /* Special type to denote reserved memory. */ | ||
| 313 | MEM_TYPE_SPARE | ||
| 309 | }; | 314 | }; |
| 310 | 315 | ||
| 311 | static void *lisp_malloc (size_t, enum mem_type); | 316 | static void *lisp_malloc (size_t, enum mem_type); |
| @@ -392,13 +397,13 @@ static struct mem_node mem_z; | |||
| 392 | static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); | 397 | static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); |
| 393 | static void lisp_free (void *); | 398 | static void lisp_free (void *); |
| 394 | static void mark_stack (void); | 399 | static void mark_stack (void); |
| 395 | static int live_vector_p (struct mem_node *, void *); | 400 | static bool live_vector_p (struct mem_node *, void *); |
| 396 | static int live_buffer_p (struct mem_node *, void *); | 401 | static bool live_buffer_p (struct mem_node *, void *); |
| 397 | static int live_string_p (struct mem_node *, void *); | 402 | static bool live_string_p (struct mem_node *, void *); |
| 398 | static int live_cons_p (struct mem_node *, void *); | 403 | static bool live_cons_p (struct mem_node *, void *); |
| 399 | static int live_symbol_p (struct mem_node *, void *); | 404 | static bool live_symbol_p (struct mem_node *, void *); |
| 400 | static int live_float_p (struct mem_node *, void *); | 405 | static bool live_float_p (struct mem_node *, void *); |
| 401 | static int live_misc_p (struct mem_node *, void *); | 406 | static bool live_misc_p (struct mem_node *, void *); |
| 402 | static void mark_maybe_object (Lisp_Object); | 407 | static void mark_maybe_object (Lisp_Object); |
| 403 | static void mark_memory (void *, void *); | 408 | static void mark_memory (void *, void *); |
| 404 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK | 409 | #if GC_MARK_STACK || defined GC_MALLOC_CHECK |
| @@ -1241,7 +1246,7 @@ static void (*old_free_hook) (void*, const void*); | |||
| 1241 | #endif | 1246 | #endif |
| 1242 | 1247 | ||
| 1243 | #ifdef GC_MALLOC_CHECK | 1248 | #ifdef GC_MALLOC_CHECK |
| 1244 | static int dont_register_blocks; | 1249 | static bool dont_register_blocks; |
| 1245 | #endif | 1250 | #endif |
| 1246 | 1251 | ||
| 1247 | static size_t bytes_used_when_reconsidered; | 1252 | static size_t bytes_used_when_reconsidered; |
| @@ -1828,11 +1833,11 @@ check_sblock (struct sblock *b) | |||
| 1828 | 1833 | ||
| 1829 | 1834 | ||
| 1830 | /* Check validity of Lisp strings' string_bytes member. ALL_P | 1835 | /* Check validity of Lisp strings' string_bytes member. ALL_P |
| 1831 | non-zero means check all strings, otherwise check only most | 1836 | means check all strings, otherwise check only most |
| 1832 | recently allocated strings. Used for hunting a bug. */ | 1837 | recently allocated strings. Used for hunting a bug. */ |
| 1833 | 1838 | ||
| 1834 | static void | 1839 | static void |
| 1835 | check_string_bytes (int all_p) | 1840 | check_string_bytes (bool all_p) |
| 1836 | { | 1841 | { |
| 1837 | if (all_p) | 1842 | if (all_p) |
| 1838 | { | 1843 | { |
| @@ -2437,9 +2442,9 @@ make_string_from_bytes (const char *contents, | |||
| 2437 | 2442 | ||
| 2438 | Lisp_Object | 2443 | Lisp_Object |
| 2439 | make_specified_string (const char *contents, | 2444 | make_specified_string (const char *contents, |
| 2440 | ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) | 2445 | ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte) |
| 2441 | { | 2446 | { |
| 2442 | register Lisp_Object val; | 2447 | Lisp_Object val; |
| 2443 | 2448 | ||
| 2444 | if (nchars < 0) | 2449 | if (nchars < 0) |
| 2445 | { | 2450 | { |
| @@ -3094,7 +3099,7 @@ sweep_vectors (void) | |||
| 3094 | 3099 | ||
| 3095 | for (block = vector_blocks; block; block = *bprev) | 3100 | for (block = vector_blocks; block; block = *bprev) |
| 3096 | { | 3101 | { |
| 3097 | int free_this_block = 0; | 3102 | bool free_this_block = 0; |
| 3098 | 3103 | ||
| 3099 | for (vector = (struct Lisp_Vector *) block->data; | 3104 | for (vector = (struct Lisp_Vector *) block->data; |
| 3100 | VECTOR_IN_BLOCK (vector, block); vector = next) | 3105 | VECTOR_IN_BLOCK (vector, block); vector = next) |
| @@ -3753,7 +3758,7 @@ void | |||
| 3753 | memory_full (size_t nbytes) | 3758 | memory_full (size_t nbytes) |
| 3754 | { | 3759 | { |
| 3755 | /* Do not go into hysterics merely because a large request failed. */ | 3760 | /* Do not go into hysterics merely because a large request failed. */ |
| 3756 | int enough_free_memory = 0; | 3761 | bool enough_free_memory = 0; |
| 3757 | if (SPARE_MEMORY < nbytes) | 3762 | if (SPARE_MEMORY < nbytes) |
| 3758 | { | 3763 | { |
| 3759 | void *p; | 3764 | void *p; |
| @@ -3816,22 +3821,22 @@ refill_memory_reserve (void) | |||
| 3816 | spare_memory[0] = malloc (SPARE_MEMORY); | 3821 | spare_memory[0] = malloc (SPARE_MEMORY); |
| 3817 | if (spare_memory[1] == 0) | 3822 | if (spare_memory[1] == 0) |
| 3818 | spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block), | 3823 | spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block), |
| 3819 | MEM_TYPE_CONS); | 3824 | MEM_TYPE_SPARE); |
| 3820 | if (spare_memory[2] == 0) | 3825 | if (spare_memory[2] == 0) |
| 3821 | spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block), | 3826 | spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block), |
| 3822 | MEM_TYPE_CONS); | 3827 | MEM_TYPE_SPARE); |
| 3823 | if (spare_memory[3] == 0) | 3828 | if (spare_memory[3] == 0) |
| 3824 | spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block), | 3829 | spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block), |
| 3825 | MEM_TYPE_CONS); | 3830 | MEM_TYPE_SPARE); |
| 3826 | if (spare_memory[4] == 0) | 3831 | if (spare_memory[4] == 0) |
| 3827 | spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block), | 3832 | spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block), |
| 3828 | MEM_TYPE_CONS); | 3833 | MEM_TYPE_SPARE); |
| 3829 | if (spare_memory[5] == 0) | 3834 | if (spare_memory[5] == 0) |
| 3830 | spare_memory[5] = lisp_malloc (sizeof (struct string_block), | 3835 | spare_memory[5] = lisp_malloc (sizeof (struct string_block), |
| 3831 | MEM_TYPE_STRING); | 3836 | MEM_TYPE_SPARE); |
| 3832 | if (spare_memory[6] == 0) | 3837 | if (spare_memory[6] == 0) |
| 3833 | spare_memory[6] = lisp_malloc (sizeof (struct string_block), | 3838 | spare_memory[6] = lisp_malloc (sizeof (struct string_block), |
| 3834 | MEM_TYPE_STRING); | 3839 | MEM_TYPE_SPARE); |
| 3835 | if (spare_memory[0] && spare_memory[1] && spare_memory[5]) | 3840 | if (spare_memory[0] && spare_memory[1] && spare_memory[5]) |
| 3836 | Vmemory_full = Qnil; | 3841 | Vmemory_full = Qnil; |
| 3837 | #endif | 3842 | #endif |
| @@ -4246,7 +4251,7 @@ mem_delete_fixup (struct mem_node *x) | |||
| 4246 | /* Value is non-zero if P is a pointer to a live Lisp string on | 4251 | /* Value is non-zero if P is a pointer to a live Lisp string on |
| 4247 | the heap. M is a pointer to the mem_block for P. */ | 4252 | the heap. M is a pointer to the mem_block for P. */ |
| 4248 | 4253 | ||
| 4249 | static inline int | 4254 | static inline bool |
| 4250 | live_string_p (struct mem_node *m, void *p) | 4255 | live_string_p (struct mem_node *m, void *p) |
| 4251 | { | 4256 | { |
| 4252 | if (m->type == MEM_TYPE_STRING) | 4257 | if (m->type == MEM_TYPE_STRING) |
| @@ -4269,7 +4274,7 @@ live_string_p (struct mem_node *m, void *p) | |||
| 4269 | /* Value is non-zero if P is a pointer to a live Lisp cons on | 4274 | /* Value is non-zero if P is a pointer to a live Lisp cons on |
| 4270 | the heap. M is a pointer to the mem_block for P. */ | 4275 | the heap. M is a pointer to the mem_block for P. */ |
| 4271 | 4276 | ||
| 4272 | static inline int | 4277 | static inline bool |
| 4273 | live_cons_p (struct mem_node *m, void *p) | 4278 | live_cons_p (struct mem_node *m, void *p) |
| 4274 | { | 4279 | { |
| 4275 | if (m->type == MEM_TYPE_CONS) | 4280 | if (m->type == MEM_TYPE_CONS) |
| @@ -4295,7 +4300,7 @@ live_cons_p (struct mem_node *m, void *p) | |||
| 4295 | /* Value is non-zero if P is a pointer to a live Lisp symbol on | 4300 | /* Value is non-zero if P is a pointer to a live Lisp symbol on |
| 4296 | the heap. M is a pointer to the mem_block for P. */ | 4301 | the heap. M is a pointer to the mem_block for P. */ |
| 4297 | 4302 | ||
| 4298 | static inline int | 4303 | static inline bool |
| 4299 | live_symbol_p (struct mem_node *m, void *p) | 4304 | live_symbol_p (struct mem_node *m, void *p) |
| 4300 | { | 4305 | { |
| 4301 | if (m->type == MEM_TYPE_SYMBOL) | 4306 | if (m->type == MEM_TYPE_SYMBOL) |
| @@ -4321,7 +4326,7 @@ live_symbol_p (struct mem_node *m, void *p) | |||
| 4321 | /* Value is non-zero if P is a pointer to a live Lisp float on | 4326 | /* Value is non-zero if P is a pointer to a live Lisp float on |
| 4322 | the heap. M is a pointer to the mem_block for P. */ | 4327 | the heap. M is a pointer to the mem_block for P. */ |
| 4323 | 4328 | ||
| 4324 | static inline int | 4329 | static inline bool |
| 4325 | live_float_p (struct mem_node *m, void *p) | 4330 | live_float_p (struct mem_node *m, void *p) |
| 4326 | { | 4331 | { |
| 4327 | if (m->type == MEM_TYPE_FLOAT) | 4332 | if (m->type == MEM_TYPE_FLOAT) |
| @@ -4345,7 +4350,7 @@ live_float_p (struct mem_node *m, void *p) | |||
| 4345 | /* Value is non-zero if P is a pointer to a live Lisp Misc on | 4350 | /* Value is non-zero if P is a pointer to a live Lisp Misc on |
| 4346 | the heap. M is a pointer to the mem_block for P. */ | 4351 | the heap. M is a pointer to the mem_block for P. */ |
| 4347 | 4352 | ||
| 4348 | static inline int | 4353 | static inline bool |
| 4349 | live_misc_p (struct mem_node *m, void *p) | 4354 | live_misc_p (struct mem_node *m, void *p) |
| 4350 | { | 4355 | { |
| 4351 | if (m->type == MEM_TYPE_MISC) | 4356 | if (m->type == MEM_TYPE_MISC) |
| @@ -4371,7 +4376,7 @@ live_misc_p (struct mem_node *m, void *p) | |||
| 4371 | /* Value is non-zero if P is a pointer to a live vector-like object. | 4376 | /* Value is non-zero if P is a pointer to a live vector-like object. |
| 4372 | M is a pointer to the mem_block for P. */ | 4377 | M is a pointer to the mem_block for P. */ |
| 4373 | 4378 | ||
| 4374 | static inline int | 4379 | static inline bool |
| 4375 | live_vector_p (struct mem_node *m, void *p) | 4380 | live_vector_p (struct mem_node *m, void *p) |
| 4376 | { | 4381 | { |
| 4377 | if (m->type == MEM_TYPE_VECTOR_BLOCK) | 4382 | if (m->type == MEM_TYPE_VECTOR_BLOCK) |
| @@ -4407,7 +4412,7 @@ live_vector_p (struct mem_node *m, void *p) | |||
| 4407 | /* Value is non-zero if P is a pointer to a live buffer. M is a | 4412 | /* Value is non-zero if P is a pointer to a live buffer. M is a |
| 4408 | pointer to the mem_block for P. */ | 4413 | pointer to the mem_block for P. */ |
| 4409 | 4414 | ||
| 4410 | static inline int | 4415 | static inline bool |
| 4411 | live_buffer_p (struct mem_node *m, void *p) | 4416 | live_buffer_p (struct mem_node *m, void *p) |
| 4412 | { | 4417 | { |
| 4413 | /* P must point to the start of the block, and the buffer | 4418 | /* P must point to the start of the block, and the buffer |
| @@ -4487,7 +4492,7 @@ mark_maybe_object (Lisp_Object obj) | |||
| 4487 | 4492 | ||
| 4488 | if (m != MEM_NIL) | 4493 | if (m != MEM_NIL) |
| 4489 | { | 4494 | { |
| 4490 | int mark_p = 0; | 4495 | bool mark_p = 0; |
| 4491 | 4496 | ||
| 4492 | switch (XTYPE (obj)) | 4497 | switch (XTYPE (obj)) |
| 4493 | { | 4498 | { |
| @@ -4561,6 +4566,7 @@ mark_maybe_pointer (void *p) | |||
| 4561 | switch (m->type) | 4566 | switch (m->type) |
| 4562 | { | 4567 | { |
| 4563 | case MEM_TYPE_NON_LISP: | 4568 | case MEM_TYPE_NON_LISP: |
| 4569 | case MEM_TYPE_SPARE: | ||
| 4564 | /* Nothing to do; not a pointer to Lisp memory. */ | 4570 | /* Nothing to do; not a pointer to Lisp memory. */ |
| 4565 | break; | 4571 | break; |
| 4566 | 4572 | ||
| @@ -4707,7 +4713,8 @@ mark_memory (void *start, void *end) | |||
| 4707 | 4713 | ||
| 4708 | #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS | 4714 | #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS |
| 4709 | 4715 | ||
| 4710 | static int setjmp_tested_p, longjmps_done; | 4716 | static bool setjmp_tested_p; |
| 4717 | static int longjmps_done; | ||
| 4711 | 4718 | ||
| 4712 | #define SETJMP_WILL_LIKELY_WORK "\ | 4719 | #define SETJMP_WILL_LIKELY_WORK "\ |
| 4713 | \n\ | 4720 | \n\ |
| @@ -4751,7 +4758,6 @@ test_setjmp (void) | |||
| 4751 | char buf[10]; | 4758 | char buf[10]; |
| 4752 | register int x; | 4759 | register int x; |
| 4753 | jmp_buf jbuf; | 4760 | jmp_buf jbuf; |
| 4754 | int result = 0; | ||
| 4755 | 4761 | ||
| 4756 | /* Arrange for X to be put in a register. */ | 4762 | /* Arrange for X to be put in a register. */ |
| 4757 | sprintf (buf, "1"); | 4763 | sprintf (buf, "1"); |
| @@ -4891,7 +4897,7 @@ mark_stack (void) | |||
| 4891 | Lisp_Object o; | 4897 | Lisp_Object o; |
| 4892 | jmp_buf j; | 4898 | jmp_buf j; |
| 4893 | } j; | 4899 | } j; |
| 4894 | volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; | 4900 | volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base; |
| 4895 | #endif | 4901 | #endif |
| 4896 | /* This trick flushes the register windows so that all the state of | 4902 | /* This trick flushes the register windows so that all the state of |
| 4897 | the process is contained in the stack. */ | 4903 | the process is contained in the stack. */ |
| @@ -4965,7 +4971,7 @@ valid_pointer_p (void *p) | |||
| 4965 | 4971 | ||
| 4966 | if (pipe (fd) == 0) | 4972 | if (pipe (fd) == 0) |
| 4967 | { | 4973 | { |
| 4968 | int valid = (emacs_write (fd[1], (char *) p, 16) == 16); | 4974 | bool valid = emacs_write (fd[1], (char *) p, 16) == 16; |
| 4969 | emacs_close (fd[1]); | 4975 | emacs_close (fd[1]); |
| 4970 | emacs_close (fd[0]); | 4976 | emacs_close (fd[0]); |
| 4971 | return valid; | 4977 | return valid; |
| @@ -5017,6 +5023,7 @@ valid_lisp_object_p (Lisp_Object obj) | |||
| 5017 | switch (m->type) | 5023 | switch (m->type) |
| 5018 | { | 5024 | { |
| 5019 | case MEM_TYPE_NON_LISP: | 5025 | case MEM_TYPE_NON_LISP: |
| 5026 | case MEM_TYPE_SPARE: | ||
| 5020 | return 0; | 5027 | return 0; |
| 5021 | 5028 | ||
| 5022 | case MEM_TYPE_BUFFER: | 5029 | case MEM_TYPE_BUFFER: |
| @@ -5186,7 +5193,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes) | |||
| 5186 | 5193 | ||
| 5187 | /* Return a string allocated in pure space. DATA is a buffer holding | 5194 | /* Return a string allocated in pure space. DATA is a buffer holding |
| 5188 | NCHARS characters, and NBYTES bytes of string data. MULTIBYTE | 5195 | NCHARS characters, and NBYTES bytes of string data. MULTIBYTE |
| 5189 | non-zero means make the result string multibyte. | 5196 | means make the result string multibyte. |
| 5190 | 5197 | ||
| 5191 | Must get an error if pure storage is full, since if it cannot hold | 5198 | Must get an error if pure storage is full, since if it cannot hold |
| 5192 | a large string it may be able to hold conses that point to that | 5199 | a large string it may be able to hold conses that point to that |
| @@ -5194,7 +5201,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes) | |||
| 5194 | 5201 | ||
| 5195 | Lisp_Object | 5202 | Lisp_Object |
| 5196 | make_pure_string (const char *data, | 5203 | make_pure_string (const char *data, |
| 5197 | ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) | 5204 | ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte) |
| 5198 | { | 5205 | { |
| 5199 | Lisp_Object string; | 5206 | Lisp_Object string; |
| 5200 | struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String); | 5207 | struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String); |
| @@ -5389,11 +5396,11 @@ returns nil, because real GC can't be done. | |||
| 5389 | See Info node `(elisp)Garbage Collection'. */) | 5396 | See Info node `(elisp)Garbage Collection'. */) |
| 5390 | (void) | 5397 | (void) |
| 5391 | { | 5398 | { |
| 5392 | register struct specbinding *bind; | 5399 | struct specbinding *bind; |
| 5393 | register struct buffer *nextb; | 5400 | struct buffer *nextb; |
| 5394 | char stack_top_variable; | 5401 | char stack_top_variable; |
| 5395 | ptrdiff_t i; | 5402 | ptrdiff_t i; |
| 5396 | int message_p; | 5403 | bool message_p; |
| 5397 | ptrdiff_t count = SPECPDL_INDEX (); | 5404 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5398 | EMACS_TIME start; | 5405 | EMACS_TIME start; |
| 5399 | Lisp_Object retval = Qnil; | 5406 | Lisp_Object retval = Qnil; |
| @@ -5472,13 +5479,9 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5472 | } | 5479 | } |
| 5473 | mark_terminals (); | 5480 | mark_terminals (); |
| 5474 | mark_kboards (); | 5481 | mark_kboards (); |
| 5475 | mark_ttys (); | ||
| 5476 | 5482 | ||
| 5477 | #ifdef USE_GTK | 5483 | #ifdef USE_GTK |
| 5478 | { | 5484 | xg_mark_data (); |
| 5479 | extern void xg_mark_data (void); | ||
| 5480 | xg_mark_data (); | ||
| 5481 | } | ||
| 5482 | #endif | 5485 | #endif |
| 5483 | 5486 | ||
| 5484 | #if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \ | 5487 | #if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \ |
| @@ -6208,10 +6211,10 @@ mark_terminals (void) | |||
| 6208 | /* Value is non-zero if OBJ will survive the current GC because it's | 6211 | /* Value is non-zero if OBJ will survive the current GC because it's |
| 6209 | either marked or does not need to be marked to survive. */ | 6212 | either marked or does not need to be marked to survive. */ |
| 6210 | 6213 | ||
| 6211 | int | 6214 | bool |
| 6212 | survives_gc_p (Lisp_Object obj) | 6215 | survives_gc_p (Lisp_Object obj) |
| 6213 | { | 6216 | { |
| 6214 | int survives_p; | 6217 | bool survives_p; |
| 6215 | 6218 | ||
| 6216 | switch (XTYPE (obj)) | 6219 | switch (XTYPE (obj)) |
| 6217 | { | 6220 | { |
| @@ -6456,7 +6459,7 @@ gc_sweep (void) | |||
| 6456 | /* Check if the symbol was created during loadup. In such a case | 6459 | /* Check if the symbol was created during loadup. In such a case |
| 6457 | it might be pointed to by pure bytecode which we don't trace, | 6460 | it might be pointed to by pure bytecode which we don't trace, |
| 6458 | so we conservatively assume that it is live. */ | 6461 | so we conservatively assume that it is live. */ |
| 6459 | int pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); | 6462 | bool pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); |
| 6460 | 6463 | ||
| 6461 | if (!sym->s.gcmarkbit && !pure_p) | 6464 | if (!sym->s.gcmarkbit && !pure_p) |
| 6462 | { | 6465 | { |
| @@ -6681,13 +6684,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) | |||
| 6681 | } | 6684 | } |
| 6682 | 6685 | ||
| 6683 | #ifdef ENABLE_CHECKING | 6686 | #ifdef ENABLE_CHECKING |
| 6684 | int suppress_checking; | 6687 | |
| 6688 | # include <execinfo.h> | ||
| 6689 | |||
| 6690 | bool suppress_checking; | ||
| 6685 | 6691 | ||
| 6686 | void | 6692 | void |
| 6687 | die (const char *msg, const char *file, int line) | 6693 | die (const char *msg, const char *file, int line) |
| 6688 | { | 6694 | { |
| 6695 | enum { NPOINTERS_MAX = 500 }; | ||
| 6696 | void *buffer[NPOINTERS_MAX]; | ||
| 6697 | int npointers; | ||
| 6689 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6698 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6690 | file, line, msg); | 6699 | file, line, msg); |
| 6700 | npointers = backtrace (buffer, NPOINTERS_MAX); | ||
| 6701 | backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); | ||
| 6691 | abort (); | 6702 | abort (); |
| 6692 | } | 6703 | } |
| 6693 | #endif | 6704 | #endif |