diff options
| author | Kenichi Handa | 2012-08-28 22:44:20 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-08-28 22:44:20 +0900 |
| commit | 4eb4de01df384be9b8d811f7ab476eeb37ece748 (patch) | |
| tree | d04f0dae31dd8b533a0c3cd738430841ce7ebb84 /src/alloc.c | |
| parent | fabc1281e9cde34ff9a19d843316d2ceca8647ad (diff) | |
| parent | 4f2daf31078e2cc059710e129dffe0beed8fc7c2 (diff) | |
| download | emacs-4eb4de01df384be9b8d811f7ab476eeb37ece748.tar.gz emacs-4eb4de01df384be9b8d811f7ab476eeb37ece748.zip | |
merge trunk
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c index f0da9416ece..36ba22cc535 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -305,7 +305,9 @@ enum mem_type | |||
| 305 | and runtime slowdown. Minor but pointless. */ | 305 | and runtime slowdown. Minor but pointless. */ |
| 306 | MEM_TYPE_VECTORLIKE, | 306 | MEM_TYPE_VECTORLIKE, |
| 307 | /* Special type to denote vector blocks. */ | 307 | /* Special type to denote vector blocks. */ |
| 308 | MEM_TYPE_VECTOR_BLOCK | 308 | MEM_TYPE_VECTOR_BLOCK, |
| 309 | /* Special type to denote reserved memory. */ | ||
| 310 | MEM_TYPE_SPARE | ||
| 309 | }; | 311 | }; |
| 310 | 312 | ||
| 311 | static void *lisp_malloc (size_t, enum mem_type); | 313 | static void *lisp_malloc (size_t, enum mem_type); |
| @@ -3816,22 +3818,22 @@ refill_memory_reserve (void) | |||
| 3816 | spare_memory[0] = malloc (SPARE_MEMORY); | 3818 | spare_memory[0] = malloc (SPARE_MEMORY); |
| 3817 | if (spare_memory[1] == 0) | 3819 | if (spare_memory[1] == 0) |
| 3818 | spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block), | 3820 | spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block), |
| 3819 | MEM_TYPE_CONS); | 3821 | MEM_TYPE_SPARE); |
| 3820 | if (spare_memory[2] == 0) | 3822 | if (spare_memory[2] == 0) |
| 3821 | spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block), | 3823 | spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block), |
| 3822 | MEM_TYPE_CONS); | 3824 | MEM_TYPE_SPARE); |
| 3823 | if (spare_memory[3] == 0) | 3825 | if (spare_memory[3] == 0) |
| 3824 | spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block), | 3826 | spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block), |
| 3825 | MEM_TYPE_CONS); | 3827 | MEM_TYPE_SPARE); |
| 3826 | if (spare_memory[4] == 0) | 3828 | if (spare_memory[4] == 0) |
| 3827 | spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block), | 3829 | spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block), |
| 3828 | MEM_TYPE_CONS); | 3830 | MEM_TYPE_SPARE); |
| 3829 | if (spare_memory[5] == 0) | 3831 | if (spare_memory[5] == 0) |
| 3830 | spare_memory[5] = lisp_malloc (sizeof (struct string_block), | 3832 | spare_memory[5] = lisp_malloc (sizeof (struct string_block), |
| 3831 | MEM_TYPE_STRING); | 3833 | MEM_TYPE_SPARE); |
| 3832 | if (spare_memory[6] == 0) | 3834 | if (spare_memory[6] == 0) |
| 3833 | spare_memory[6] = lisp_malloc (sizeof (struct string_block), | 3835 | spare_memory[6] = lisp_malloc (sizeof (struct string_block), |
| 3834 | MEM_TYPE_STRING); | 3836 | MEM_TYPE_SPARE); |
| 3835 | if (spare_memory[0] && spare_memory[1] && spare_memory[5]) | 3837 | if (spare_memory[0] && spare_memory[1] && spare_memory[5]) |
| 3836 | Vmemory_full = Qnil; | 3838 | Vmemory_full = Qnil; |
| 3837 | #endif | 3839 | #endif |
| @@ -4561,6 +4563,7 @@ mark_maybe_pointer (void *p) | |||
| 4561 | switch (m->type) | 4563 | switch (m->type) |
| 4562 | { | 4564 | { |
| 4563 | case MEM_TYPE_NON_LISP: | 4565 | case MEM_TYPE_NON_LISP: |
| 4566 | case MEM_TYPE_SPARE: | ||
| 4564 | /* Nothing to do; not a pointer to Lisp memory. */ | 4567 | /* Nothing to do; not a pointer to Lisp memory. */ |
| 4565 | break; | 4568 | break; |
| 4566 | 4569 | ||
| @@ -5017,6 +5020,7 @@ valid_lisp_object_p (Lisp_Object obj) | |||
| 5017 | switch (m->type) | 5020 | switch (m->type) |
| 5018 | { | 5021 | { |
| 5019 | case MEM_TYPE_NON_LISP: | 5022 | case MEM_TYPE_NON_LISP: |
| 5023 | case MEM_TYPE_SPARE: | ||
| 5020 | return 0; | 5024 | return 0; |
| 5021 | 5025 | ||
| 5022 | case MEM_TYPE_BUFFER: | 5026 | case MEM_TYPE_BUFFER: |
| @@ -6681,13 +6685,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) | |||
| 6681 | } | 6685 | } |
| 6682 | 6686 | ||
| 6683 | #ifdef ENABLE_CHECKING | 6687 | #ifdef ENABLE_CHECKING |
| 6688 | |||
| 6689 | # include <execinfo.h> | ||
| 6690 | |||
| 6684 | bool suppress_checking; | 6691 | bool suppress_checking; |
| 6685 | 6692 | ||
| 6686 | void | 6693 | void |
| 6687 | die (const char *msg, const char *file, int line) | 6694 | die (const char *msg, const char *file, int line) |
| 6688 | { | 6695 | { |
| 6696 | enum { NPOINTERS_MAX = 500 }; | ||
| 6697 | void *buffer[NPOINTERS_MAX]; | ||
| 6698 | int npointers; | ||
| 6689 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", | 6699 | fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", |
| 6690 | file, line, msg); | 6700 | file, line, msg); |
| 6701 | npointers = backtrace (buffer, NPOINTERS_MAX); | ||
| 6702 | backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); | ||
| 6691 | abort (); | 6703 | abort (); |
| 6692 | } | 6704 | } |
| 6693 | #endif | 6705 | #endif |