diff options
| author | Joakim Verona | 2012-09-10 16:03:53 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-09-10 16:03:53 +0200 |
| commit | b035a30e5cd2f34fedc04c253eeb5a11afed8145 (patch) | |
| tree | b9350cce389602f4967bdc1beed745929155ad5d /src/alloc.c | |
| parent | 4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (diff) | |
| parent | a31a4cdacb196cc96dcb9bd229edb1d635e01344 (diff) | |
| download | emacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.tar.gz emacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.zip | |
upstream
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/alloc.c b/src/alloc.c index 188a514376d..33dc68df48e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -26,7 +26,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <limits.h> /* For CHAR_BIT. */ | 26 | #include <limits.h> /* For CHAR_BIT. */ |
| 27 | #include <setjmp.h> | 27 | #include <setjmp.h> |
| 28 | 28 | ||
| 29 | #include <signal.h> | 29 | #ifdef ENABLE_CHECKING |
| 30 | #include <signal.h> /* For SIGABRT. */ | ||
| 31 | #endif | ||
| 30 | 32 | ||
| 31 | #ifdef HAVE_PTHREAD | 33 | #ifdef HAVE_PTHREAD |
| 32 | #include <pthread.h> | 34 | #include <pthread.h> |
| @@ -42,7 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | #include "keyboard.h" | 44 | #include "keyboard.h" |
| 43 | #include "frame.h" | 45 | #include "frame.h" |
| 44 | #include "blockinput.h" | 46 | #include "blockinput.h" |
| 45 | #include "syssignal.h" | ||
| 46 | #include "termhooks.h" /* For struct terminal. */ | 47 | #include "termhooks.h" /* For struct terminal. */ |
| 47 | #include <setjmp.h> | 48 | #include <setjmp.h> |
| 48 | #include <verify.h> | 49 | #include <verify.h> |
| @@ -278,6 +279,7 @@ static void gc_sweep (void); | |||
| 278 | static Lisp_Object make_pure_vector (ptrdiff_t); | 279 | static Lisp_Object make_pure_vector (ptrdiff_t); |
| 279 | static void mark_glyph_matrix (struct glyph_matrix *); | 280 | static void mark_glyph_matrix (struct glyph_matrix *); |
| 280 | static void mark_face_cache (struct face_cache *); | 281 | static void mark_face_cache (struct face_cache *); |
| 282 | static void mark_buffer (struct buffer *); | ||
| 281 | 283 | ||
| 282 | #if !defined REL_ALLOC || defined SYSTEM_MALLOC | 284 | #if !defined REL_ALLOC || defined SYSTEM_MALLOC |
| 283 | static void refill_memory_reserve (void); | 285 | static void refill_memory_reserve (void); |
| @@ -613,7 +615,7 @@ overrun_check_malloc (size_t size) | |||
| 613 | register unsigned char *val; | 615 | register unsigned char *val; |
| 614 | int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; | 616 | int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; |
| 615 | if (SIZE_MAX - overhead < size) | 617 | if (SIZE_MAX - overhead < size) |
| 616 | abort (); | 618 | emacs_abort (); |
| 617 | 619 | ||
| 618 | val = malloc (size + overhead); | 620 | val = malloc (size + overhead); |
| 619 | if (val && check_depth == 1) | 621 | if (val && check_depth == 1) |
| @@ -638,7 +640,7 @@ overrun_check_realloc (void *block, size_t size) | |||
| 638 | register unsigned char *val = (unsigned char *) block; | 640 | register unsigned char *val = (unsigned char *) block; |
| 639 | int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; | 641 | int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; |
| 640 | if (SIZE_MAX - overhead < size) | 642 | if (SIZE_MAX - overhead < size) |
| 641 | abort (); | 643 | emacs_abort (); |
| 642 | 644 | ||
| 643 | if (val | 645 | if (val |
| 644 | && check_depth == 1 | 646 | && check_depth == 1 |
| @@ -649,7 +651,7 @@ overrun_check_realloc (void *block, size_t size) | |||
| 649 | size_t osize = xmalloc_get_size (val); | 651 | size_t osize = xmalloc_get_size (val); |
| 650 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, | 652 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 651 | XMALLOC_OVERRUN_CHECK_SIZE)) | 653 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 652 | abort (); | 654 | emacs_abort (); |
| 653 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); | 655 | memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); |
| 654 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; | 656 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 655 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); | 657 | memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); |
| @@ -686,7 +688,7 @@ overrun_check_free (void *block) | |||
| 686 | size_t osize = xmalloc_get_size (val); | 688 | size_t osize = xmalloc_get_size (val); |
| 687 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, | 689 | if (memcmp (xmalloc_overrun_check_trailer, val + osize, |
| 688 | XMALLOC_OVERRUN_CHECK_SIZE)) | 690 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 689 | abort (); | 691 | emacs_abort (); |
| 690 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | 692 | #ifdef XMALLOC_CLEAR_FREE_MEMORY |
| 691 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; | 693 | val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; |
| 692 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD); | 694 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD); |
| @@ -1272,7 +1274,7 @@ emacs_blocked_free (void *ptr, const void *ptr2) | |||
| 1272 | { | 1274 | { |
| 1273 | fprintf (stderr, | 1275 | fprintf (stderr, |
| 1274 | "Freeing `%p' which wasn't allocated with malloc\n", ptr); | 1276 | "Freeing `%p' which wasn't allocated with malloc\n", ptr); |
| 1275 | abort (); | 1277 | emacs_abort (); |
| 1276 | } | 1278 | } |
| 1277 | else | 1279 | else |
| 1278 | { | 1280 | { |
| @@ -1331,7 +1333,7 @@ emacs_blocked_malloc (size_t size, const void *ptr) | |||
| 1331 | fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n", | 1333 | fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n", |
| 1332 | m->start, m->end, (char *) m->end - (char *) m->start, | 1334 | m->start, m->end, (char *) m->end - (char *) m->start, |
| 1333 | m->type); | 1335 | m->type); |
| 1334 | abort (); | 1336 | emacs_abort (); |
| 1335 | } | 1337 | } |
| 1336 | 1338 | ||
| 1337 | if (!dont_register_blocks) | 1339 | if (!dont_register_blocks) |
| @@ -1369,7 +1371,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) | |||
| 1369 | fprintf (stderr, | 1371 | fprintf (stderr, |
| 1370 | "Realloc of %p which wasn't allocated with malloc\n", | 1372 | "Realloc of %p which wasn't allocated with malloc\n", |
| 1371 | ptr); | 1373 | ptr); |
| 1372 | abort (); | 1374 | emacs_abort (); |
| 1373 | } | 1375 | } |
| 1374 | 1376 | ||
| 1375 | mem_delete (m); | 1377 | mem_delete (m); |
| @@ -1391,7 +1393,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) | |||
| 1391 | if (m != MEM_NIL) | 1393 | if (m != MEM_NIL) |
| 1392 | { | 1394 | { |
| 1393 | fprintf (stderr, "Realloc returns memory that is already in use\n"); | 1395 | fprintf (stderr, "Realloc returns memory that is already in use\n"); |
| 1394 | abort (); | 1396 | emacs_abort (); |
| 1395 | } | 1397 | } |
| 1396 | 1398 | ||
| 1397 | /* Can't handle zero size regions in the red-black tree. */ | 1399 | /* Can't handle zero size regions in the red-black tree. */ |
| @@ -1804,7 +1806,7 @@ string_bytes (struct Lisp_String *s) | |||
| 1804 | if (!PURE_POINTER_P (s) | 1806 | if (!PURE_POINTER_P (s) |
| 1805 | && s->data | 1807 | && s->data |
| 1806 | && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s))) | 1808 | && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s))) |
| 1807 | abort (); | 1809 | emacs_abort (); |
| 1808 | return nbytes; | 1810 | return nbytes; |
| 1809 | } | 1811 | } |
| 1810 | 1812 | ||
| @@ -1878,7 +1880,7 @@ check_string_free_list (void) | |||
| 1878 | while (s != NULL) | 1880 | while (s != NULL) |
| 1879 | { | 1881 | { |
| 1880 | if ((uintptr_t) s < 1024) | 1882 | if ((uintptr_t) s < 1024) |
| 1881 | abort (); | 1883 | emacs_abort (); |
| 1882 | s = NEXT_FREE_LISP_STRING (s); | 1884 | s = NEXT_FREE_LISP_STRING (s); |
| 1883 | } | 1885 | } |
| 1884 | } | 1886 | } |
| @@ -2107,7 +2109,7 @@ sweep_strings (void) | |||
| 2107 | back-pointer so that we know it's free. */ | 2109 | back-pointer so that we know it's free. */ |
| 2108 | #ifdef GC_CHECK_STRING_BYTES | 2110 | #ifdef GC_CHECK_STRING_BYTES |
| 2109 | if (string_bytes (s) != SDATA_NBYTES (data)) | 2111 | if (string_bytes (s) != SDATA_NBYTES (data)) |
| 2110 | abort (); | 2112 | emacs_abort (); |
| 2111 | #else | 2113 | #else |
| 2112 | data->u.nbytes = STRING_BYTES (s); | 2114 | data->u.nbytes = STRING_BYTES (s); |
| 2113 | #endif | 2115 | #endif |
| @@ -2218,7 +2220,7 @@ compact_small_strings (void) | |||
| 2218 | /* Check that the string size recorded in the string is the | 2220 | /* Check that the string size recorded in the string is the |
| 2219 | same as the one recorded in the sdata structure. */ | 2221 | same as the one recorded in the sdata structure. */ |
| 2220 | if (s && string_bytes (s) != SDATA_NBYTES (from)) | 2222 | if (s && string_bytes (s) != SDATA_NBYTES (from)) |
| 2221 | abort (); | 2223 | emacs_abort (); |
| 2222 | #endif /* GC_CHECK_STRING_BYTES */ | 2224 | #endif /* GC_CHECK_STRING_BYTES */ |
| 2223 | 2225 | ||
| 2224 | nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from); | 2226 | nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from); |
| @@ -2231,7 +2233,7 @@ compact_small_strings (void) | |||
| 2231 | if (memcmp (string_overrun_cookie, | 2233 | if (memcmp (string_overrun_cookie, |
| 2232 | (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, | 2234 | (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, |
| 2233 | GC_STRING_OVERRUN_COOKIE_SIZE)) | 2235 | GC_STRING_OVERRUN_COOKIE_SIZE)) |
| 2234 | abort (); | 2236 | emacs_abort (); |
| 2235 | #endif | 2237 | #endif |
| 2236 | 2238 | ||
| 2237 | /* Non-NULL S means it's alive. Copy its data. */ | 2239 | /* Non-NULL S means it's alive. Copy its data. */ |
| @@ -2488,7 +2490,7 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes) | |||
| 2488 | struct Lisp_String *s; | 2490 | struct Lisp_String *s; |
| 2489 | 2491 | ||
| 2490 | if (nchars < 0) | 2492 | if (nchars < 0) |
| 2491 | abort (); | 2493 | emacs_abort (); |
| 2492 | if (!nbytes) | 2494 | if (!nbytes) |
| 2493 | return empty_multibyte_string; | 2495 | return empty_multibyte_string; |
| 2494 | 2496 | ||
| @@ -2809,7 +2811,7 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) | |||
| 2809 | else if (type == CONSTYPE_HEAP) | 2811 | else if (type == CONSTYPE_HEAP) |
| 2810 | val = Fcons (objp[i], val); | 2812 | val = Fcons (objp[i], val); |
| 2811 | else | 2813 | else |
| 2812 | abort (); | 2814 | emacs_abort (); |
| 2813 | } | 2815 | } |
| 2814 | return val; | 2816 | return val; |
| 2815 | } | 2817 | } |
| @@ -3281,7 +3283,10 @@ allocate_buffer (void) | |||
| 3281 | 3283 | ||
| 3282 | XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) | 3284 | XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) |
| 3283 | - header_size) / word_size); | 3285 | - header_size) / word_size); |
| 3284 | /* Note that the fields of B are not initialized. */ | 3286 | /* Put B on the chain of all buffers including killed ones. */ |
| 3287 | b->header.next.buffer = all_buffers; | ||
| 3288 | all_buffers = b; | ||
| 3289 | /* Note that the rest fields of B are not initialized. */ | ||
| 3285 | return b; | 3290 | return b; |
| 3286 | } | 3291 | } |
| 3287 | 3292 | ||
| @@ -3919,7 +3924,7 @@ mem_insert (void *start, void *end, enum mem_type type) | |||
| 3919 | while (c != MEM_NIL) | 3924 | while (c != MEM_NIL) |
| 3920 | { | 3925 | { |
| 3921 | if (start >= c->start && start < c->end) | 3926 | if (start >= c->start && start < c->end) |
| 3922 | abort (); | 3927 | emacs_abort (); |
| 3923 | parent = c; | 3928 | parent = c; |
| 3924 | c = start < c->start ? c->left : c->right; | 3929 | c = start < c->start ? c->left : c->right; |
| 3925 | } | 3930 | } |
| @@ -3938,7 +3943,7 @@ mem_insert (void *start, void *end, enum mem_type type) | |||
| 3938 | #ifdef GC_MALLOC_CHECK | 3943 | #ifdef GC_MALLOC_CHECK |
| 3939 | x = _malloc_internal (sizeof *x); | 3944 | x = _malloc_internal (sizeof *x); |
| 3940 | if (x == NULL) | 3945 | if (x == NULL) |
| 3941 | abort (); | 3946 | emacs_abort (); |
| 3942 | #else | 3947 | #else |
| 3943 | x = xmalloc (sizeof *x); | 3948 | x = xmalloc (sizeof *x); |
| 3944 | #endif | 3949 | #endif |
| @@ -4613,7 +4618,7 @@ mark_maybe_pointer (void *p) | |||
| 4613 | break; | 4618 | break; |
| 4614 | 4619 | ||
| 4615 | default: | 4620 | default: |
| 4616 | abort (); | 4621 | emacs_abort (); |
| 4617 | } | 4622 | } |
| 4618 | 4623 | ||
| 4619 | if (!NILP (obj)) | 4624 | if (!NILP (obj)) |
| @@ -4764,7 +4769,7 @@ test_setjmp (void) | |||
| 4764 | x = strlen (buf); | 4769 | x = strlen (buf); |
| 4765 | x = 2 * x - 1; | 4770 | x = 2 * x - 1; |
| 4766 | 4771 | ||
| 4767 | setjmp (jbuf); | 4772 | _setjmp (jbuf); |
| 4768 | if (longjmps_done == 1) | 4773 | if (longjmps_done == 1) |
| 4769 | { | 4774 | { |
| 4770 | /* Came here after the longjmp at the end of the function. | 4775 | /* Came here after the longjmp at the end of the function. |
| @@ -4789,7 +4794,7 @@ test_setjmp (void) | |||
| 4789 | ++longjmps_done; | 4794 | ++longjmps_done; |
| 4790 | x = 2; | 4795 | x = 2; |
| 4791 | if (longjmps_done == 1) | 4796 | if (longjmps_done == 1) |
| 4792 | longjmp (jbuf, 1); | 4797 | _longjmp (jbuf, 1); |
| 4793 | } | 4798 | } |
| 4794 | 4799 | ||
| 4795 | #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ | 4800 | #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ |
| @@ -4810,7 +4815,7 @@ check_gcpros (void) | |||
| 4810 | if (!survives_gc_p (p->var[i])) | 4815 | if (!survives_gc_p (p->var[i])) |
| 4811 | /* FIXME: It's not necessarily a bug. It might just be that the | 4816 | /* FIXME: It's not necessarily a bug. It might just be that the |
| 4812 | GCPRO is unnecessary or should release the object sooner. */ | 4817 | GCPRO is unnecessary or should release the object sooner. */ |
| 4813 | abort (); | 4818 | emacs_abort (); |
| 4814 | } | 4819 | } |
| 4815 | 4820 | ||
| 4816 | #elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES | 4821 | #elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES |
| @@ -4931,7 +4936,7 @@ mark_stack (void) | |||
| 4931 | } | 4936 | } |
| 4932 | #endif /* GC_SETJMP_WORKS */ | 4937 | #endif /* GC_SETJMP_WORKS */ |
| 4933 | 4938 | ||
| 4934 | setjmp (j.j); | 4939 | _setjmp (j.j); |
| 4935 | end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; | 4940 | end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; |
| 4936 | #endif /* not GC_SAVE_REGISTERS_ON_STACK */ | 4941 | #endif /* not GC_SAVE_REGISTERS_ON_STACK */ |
| 4937 | #endif /* not HAVE___BUILTIN_UNWIND_INIT */ | 4942 | #endif /* not HAVE___BUILTIN_UNWIND_INIT */ |
| @@ -4981,7 +4986,8 @@ valid_pointer_p (void *p) | |||
| 4981 | #endif | 4986 | #endif |
| 4982 | } | 4987 | } |
| 4983 | 4988 | ||
| 4984 | /* Return 1 if OBJ is a valid lisp object. | 4989 | /* Return 2 if OBJ is a killed or special buffer object. |
| 4990 | Return 1 if OBJ is a valid lisp object. | ||
| 4985 | Return 0 if OBJ is NOT a valid lisp object. | 4991 | Return 0 if OBJ is NOT a valid lisp object. |
| 4986 | Return -1 if we cannot validate OBJ. | 4992 | Return -1 if we cannot validate OBJ. |
| 4987 | This function can be quite slow, | 4993 | This function can be quite slow, |
| @@ -5002,6 +5008,9 @@ valid_lisp_object_p (Lisp_Object obj) | |||
| 5002 | if (PURE_POINTER_P (p)) | 5008 | if (PURE_POINTER_P (p)) |
| 5003 | return 1; | 5009 | return 1; |
| 5004 | 5010 | ||
| 5011 | if (p == &buffer_defaults || p == &buffer_local_symbols) | ||
| 5012 | return 2; | ||
| 5013 | |||
| 5005 | #if !GC_MARK_STACK | 5014 | #if !GC_MARK_STACK |
| 5006 | return valid_pointer_p (p); | 5015 | return valid_pointer_p (p); |
| 5007 | #else | 5016 | #else |
| @@ -5027,7 +5036,7 @@ valid_lisp_object_p (Lisp_Object obj) | |||
| 5027 | return 0; | 5036 | return 0; |
| 5028 | 5037 | ||
| 5029 | case MEM_TYPE_BUFFER: | 5038 | case MEM_TYPE_BUFFER: |
| 5030 | return live_buffer_p (m, p); | 5039 | return live_buffer_p (m, p) ? 1 : 2; |
| 5031 | 5040 | ||
| 5032 | case MEM_TYPE_CONS: | 5041 | case MEM_TYPE_CONS: |
| 5033 | return live_cons_p (m, p); | 5042 | return live_cons_p (m, p); |
| @@ -5351,7 +5360,7 @@ staticpro (Lisp_Object *varaddress) | |||
| 5351 | { | 5360 | { |
| 5352 | staticvec[staticidx++] = varaddress; | 5361 | staticvec[staticidx++] = varaddress; |
| 5353 | if (staticidx >= NSTATICS) | 5362 | if (staticidx >= NSTATICS) |
| 5354 | abort (); | 5363 | emacs_abort (); |
| 5355 | } | 5364 | } |
| 5356 | 5365 | ||
| 5357 | 5366 | ||
| @@ -5406,7 +5415,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5406 | Lisp_Object retval = Qnil; | 5415 | Lisp_Object retval = Qnil; |
| 5407 | 5416 | ||
| 5408 | if (abort_on_gc) | 5417 | if (abort_on_gc) |
| 5409 | abort (); | 5418 | emacs_abort (); |
| 5410 | 5419 | ||
| 5411 | /* Can't GC if pure storage overflowed because we can't determine | 5420 | /* Can't GC if pure storage overflowed because we can't determine |
| 5412 | if something is a pure object or not. */ | 5421 | if something is a pure object or not. */ |
| @@ -5469,6 +5478,9 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5469 | 5478 | ||
| 5470 | /* Mark all the special slots that serve as the roots of accessibility. */ | 5479 | /* Mark all the special slots that serve as the roots of accessibility. */ |
| 5471 | 5480 | ||
| 5481 | mark_buffer (&buffer_defaults); | ||
| 5482 | mark_buffer (&buffer_local_symbols); | ||
| 5483 | |||
| 5472 | for (i = 0; i < staticidx; i++) | 5484 | for (i = 0; i < staticidx; i++) |
| 5473 | mark_object (*staticvec[i]); | 5485 | mark_object (*staticvec[i]); |
| 5474 | 5486 | ||
| @@ -5887,7 +5899,7 @@ mark_object (Lisp_Object arg) | |||
| 5887 | do { \ | 5899 | do { \ |
| 5888 | m = mem_find (po); \ | 5900 | m = mem_find (po); \ |
| 5889 | if (m == MEM_NIL) \ | 5901 | if (m == MEM_NIL) \ |
| 5890 | abort (); \ | 5902 | emacs_abort (); \ |
| 5891 | } while (0) | 5903 | } while (0) |
| 5892 | 5904 | ||
| 5893 | /* Check that the object pointed to by PO is live, using predicate | 5905 | /* Check that the object pointed to by PO is live, using predicate |
| @@ -5895,7 +5907,7 @@ mark_object (Lisp_Object arg) | |||
| 5895 | #define CHECK_LIVE(LIVEP) \ | 5907 | #define CHECK_LIVE(LIVEP) \ |
| 5896 | do { \ | 5908 | do { \ |
| 5897 | if (!LIVEP (m, po)) \ | 5909 | if (!LIVEP (m, po)) \ |
| 5898 | abort (); \ | 5910 | emacs_abort (); \ |
| 5899 | } while (0) | 5911 | } while (0) |
| 5900 | 5912 | ||
| 5901 | /* Check both of the above conditions. */ | 5913 | /* Check both of the above conditions. */ |
| @@ -5940,10 +5952,8 @@ mark_object (Lisp_Object arg) | |||
| 5940 | 5952 | ||
| 5941 | #ifdef GC_CHECK_MARKED_OBJECTS | 5953 | #ifdef GC_CHECK_MARKED_OBJECTS |
| 5942 | m = mem_find (po); | 5954 | m = mem_find (po); |
| 5943 | if (m == MEM_NIL && !SUBRP (obj) | 5955 | if (m == MEM_NIL && !SUBRP (obj)) |
| 5944 | && po != &buffer_defaults | 5956 | emacs_abort (); |
| 5945 | && po != &buffer_local_symbols) | ||
| 5946 | abort (); | ||
| 5947 | #endif /* GC_CHECK_MARKED_OBJECTS */ | 5957 | #endif /* GC_CHECK_MARKED_OBJECTS */ |
| 5948 | 5958 | ||
| 5949 | if (ptr->header.size & PSEUDOVECTOR_FLAG) | 5959 | if (ptr->header.size & PSEUDOVECTOR_FLAG) |
| @@ -5959,15 +5969,14 @@ mark_object (Lisp_Object arg) | |||
| 5959 | { | 5969 | { |
| 5960 | case PVEC_BUFFER: | 5970 | case PVEC_BUFFER: |
| 5961 | #ifdef GC_CHECK_MARKED_OBJECTS | 5971 | #ifdef GC_CHECK_MARKED_OBJECTS |
| 5962 | if (po != &buffer_defaults && po != &buffer_local_symbols) | 5972 | { |
| 5963 | { | 5973 | struct buffer *b; |
| 5964 | struct buffer *b; | 5974 | FOR_EACH_BUFFER (b) |
| 5965 | FOR_EACH_BUFFER (b) | 5975 | if (b == po) |
| 5966 | if (b == po) | 5976 | break; |
| 5967 | break; | 5977 | if (b == NULL) |
| 5968 | if (b == NULL) | 5978 | emacs_abort (); |
| 5969 | abort (); | 5979 | } |
| 5970 | } | ||
| 5971 | #endif /* GC_CHECK_MARKED_OBJECTS */ | 5980 | #endif /* GC_CHECK_MARKED_OBJECTS */ |
| 5972 | mark_buffer ((struct buffer *) ptr); | 5981 | mark_buffer ((struct buffer *) ptr); |
| 5973 | break; | 5982 | break; |
| @@ -5992,10 +6001,8 @@ mark_object (Lisp_Object arg) | |||
| 5992 | break; | 6001 | break; |
| 5993 | 6002 | ||
| 5994 | case PVEC_FRAME: | 6003 | case PVEC_FRAME: |
| 5995 | { | 6004 | mark_vectorlike (ptr); |
| 5996 | mark_vectorlike (ptr); | 6005 | mark_face_cache (((struct frame *) ptr)->face_cache); |
| 5997 | mark_face_cache (((struct frame *) ptr)->face_cache); | ||
| 5998 | } | ||
| 5999 | break; | 6006 | break; |
| 6000 | 6007 | ||
| 6001 | case PVEC_WINDOW: | 6008 | case PVEC_WINDOW: |
| @@ -6042,7 +6049,7 @@ mark_object (Lisp_Object arg) | |||
| 6042 | break; | 6049 | break; |
| 6043 | 6050 | ||
| 6044 | case PVEC_FREE: | 6051 | case PVEC_FREE: |
| 6045 | abort (); | 6052 | emacs_abort (); |
| 6046 | 6053 | ||
| 6047 | default: | 6054 | default: |
| 6048 | mark_vectorlike (ptr); | 6055 | mark_vectorlike (ptr); |
| @@ -6089,7 +6096,7 @@ mark_object (Lisp_Object arg) | |||
| 6089 | And if it's forwarded to a C variable, either it's not | 6096 | And if it's forwarded to a C variable, either it's not |
| 6090 | a Lisp_Object var, or it's staticpro'd already. */ | 6097 | a Lisp_Object var, or it's staticpro'd already. */ |
| 6091 | break; | 6098 | break; |
| 6092 | default: abort (); | 6099 | default: emacs_abort (); |
| 6093 | } | 6100 | } |
| 6094 | if (!PURE_POINTER_P (XSTRING (ptr->name))) | 6101 | if (!PURE_POINTER_P (XSTRING (ptr->name))) |
| 6095 | MARK_STRING (XSTRING (ptr->name)); | 6102 | MARK_STRING (XSTRING (ptr->name)); |
| @@ -6143,7 +6150,7 @@ mark_object (Lisp_Object arg) | |||
| 6143 | break; | 6150 | break; |
| 6144 | 6151 | ||
| 6145 | default: | 6152 | default: |
| 6146 | abort (); | 6153 | emacs_abort (); |
| 6147 | } | 6154 | } |
| 6148 | break; | 6155 | break; |
| 6149 | 6156 | ||
| @@ -6165,7 +6172,7 @@ mark_object (Lisp_Object arg) | |||
| 6165 | obj = ptr->u.cdr; | 6172 | obj = ptr->u.cdr; |
| 6166 | cdr_count++; | 6173 | cdr_count++; |
| 6167 | if (cdr_count == mark_object_loop_halt) | 6174 | if (cdr_count == mark_object_loop_halt) |
| 6168 | abort (); | 6175 | emacs_abort (); |
| 6169 | goto loop; | 6176 | goto loop; |
| 6170 | } | 6177 | } |
| 6171 | 6178 | ||
| @@ -6178,7 +6185,7 @@ mark_object (Lisp_Object arg) | |||
| 6178 | break; | 6185 | break; |
| 6179 | 6186 | ||
| 6180 | default: | 6187 | default: |
| 6181 | abort (); | 6188 | emacs_abort (); |
| 6182 | } | 6189 | } |
| 6183 | 6190 | ||
| 6184 | #undef CHECK_LIVE | 6191 | #undef CHECK_LIVE |
| @@ -6247,7 +6254,7 @@ survives_gc_p (Lisp_Object obj) | |||
| 6247 | break; | 6254 | break; |
| 6248 | 6255 | ||
| 6249 | default: | 6256 | default: |
| 6250 | abort (); | 6257 | emacs_abort (); |
| 6251 | } | 6258 | } |
| 6252 | 6259 | ||
| 6253 | return survives_p || PURE_POINTER_P ((void *) XPNTR (obj)); | 6260 | return survives_p || PURE_POINTER_P ((void *) XPNTR (obj)); |
| @@ -6685,21 +6692,14 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) | |||
| 6685 | 6692 | ||
| 6686 | #ifdef ENABLE_CHECKING | 6693 | #ifdef ENABLE_CHECKING |
| 6687 | 6694 | ||
| 6688 | # include <execinfo.h> | ||
| 6689 | |||
| 6690 | bool suppress_checking; | 6695 | bool suppress_checking; |
| 6691 | 6696 | ||
| 6692 | void | 6697 | void |
| 6693 | die (const char *msg, const char *file, int line) | 6698 | die (const char *msg, const char *file, int line) |
| 6694 | { | 6699 | { |
| 6695 | enum { NPOINTERS_MAX = 500 }; | ||
| 6696 | void *buffer[NPOINTERS_MAX]; | ||
| 6697 | int npointers; | ||
| 6698 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6700 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6699 | file, line, msg); | 6701 | file, line, msg); |
| 6700 | npointers = backtrace (buffer, NPOINTERS_MAX); | 6702 | fatal_error_backtrace (SIGABRT, INT_MAX); |
| 6701 | backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); | ||
| 6702 | abort (); | ||
| 6703 | } | 6703 | } |
| 6704 | #endif | 6704 | #endif |
| 6705 | 6705 | ||