Mercurial > emacs
comparison src/alloc.c @ 68350:263a4edafafa
(lisp_align_free): Add an assertion.
(make_interval, allocate_string, make_float, allocate_misc, Fmake_symbol
(Fcons): If ENABLE_CHECKING is on, check we're not called from a sighandler.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Mon, 23 Jan 2006 02:35:36 +0000 |
| parents | 28fd92314a04 |
| children | 3422c551ad06 |
comparison
equal
deleted
inserted
replaced
| 68349:83bfe0ee63f6 | 68350:263a4edafafa |
|---|---|
| 1 /* Storage allocation and gc for GNU Emacs Lisp interpreter. | 1 /* Storage allocation and gc for GNU Emacs Lisp interpreter. |
| 2 Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999, | 2 Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999, |
| 3 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | 3 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GNU Emacs. | 5 This file is part of GNU Emacs. |
| 6 | 6 |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | 7 GNU Emacs is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 1103 else | 1103 else |
| 1104 tem = &(*tem)->x.next_free; | 1104 tem = &(*tem)->x.next_free; |
| 1105 } | 1105 } |
| 1106 eassert ((aligned & 1) == aligned); | 1106 eassert ((aligned & 1) == aligned); |
| 1107 eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1)); | 1107 eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1)); |
| 1108 #ifdef HAVE_POSIX_MEMALIGN | |
| 1109 eassert ((unsigned long)ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0); | |
| 1110 #endif | |
| 1108 free (ABLOCKS_BASE (abase)); | 1111 free (ABLOCKS_BASE (abase)); |
| 1109 } | 1112 } |
| 1110 UNBLOCK_INPUT; | 1113 UNBLOCK_INPUT; |
| 1111 } | 1114 } |
| 1112 | 1115 |
| 1417 INTERVAL | 1420 INTERVAL |
| 1418 make_interval () | 1421 make_interval () |
| 1419 { | 1422 { |
| 1420 INTERVAL val; | 1423 INTERVAL val; |
| 1421 | 1424 |
| 1425 eassert (!handling_signal); | |
| 1426 | |
| 1422 if (interval_free_list) | 1427 if (interval_free_list) |
| 1423 { | 1428 { |
| 1424 val = interval_free_list; | 1429 val = interval_free_list; |
| 1425 interval_free_list = INTERVAL_PARENT (interval_free_list); | 1430 interval_free_list = INTERVAL_PARENT (interval_free_list); |
| 1426 } | 1431 } |
| 1834 | 1839 |
| 1835 static struct Lisp_String * | 1840 static struct Lisp_String * |
| 1836 allocate_string () | 1841 allocate_string () |
| 1837 { | 1842 { |
| 1838 struct Lisp_String *s; | 1843 struct Lisp_String *s; |
| 1844 | |
| 1845 eassert (!handling_signal); | |
| 1839 | 1846 |
| 1840 /* If the free-list is empty, allocate a new string_block, and | 1847 /* If the free-list is empty, allocate a new string_block, and |
| 1841 add all the Lisp_Strings in it to the free-list. */ | 1848 add all the Lisp_Strings in it to the free-list. */ |
| 1842 if (string_free_list == NULL) | 1849 if (string_free_list == NULL) |
| 1843 { | 1850 { |
| 2550 make_float (float_value) | 2557 make_float (float_value) |
| 2551 double float_value; | 2558 double float_value; |
| 2552 { | 2559 { |
| 2553 register Lisp_Object val; | 2560 register Lisp_Object val; |
| 2554 | 2561 |
| 2562 eassert (!handling_signal); | |
| 2563 | |
| 2555 if (float_free_list) | 2564 if (float_free_list) |
| 2556 { | 2565 { |
| 2557 /* We use the data field for chaining the free list | 2566 /* We use the data field for chaining the free list |
| 2558 so that we won't use the same field that has the mark bit. */ | 2567 so that we won't use the same field that has the mark bit. */ |
| 2559 XSETFLOAT (val, float_free_list); | 2568 XSETFLOAT (val, float_free_list); |
| 2668 doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) | 2677 doc: /* Create a new cons, give it CAR and CDR as components, and return it. */) |
| 2669 (car, cdr) | 2678 (car, cdr) |
| 2670 Lisp_Object car, cdr; | 2679 Lisp_Object car, cdr; |
| 2671 { | 2680 { |
| 2672 register Lisp_Object val; | 2681 register Lisp_Object val; |
| 2682 | |
| 2683 eassert (!handling_signal); | |
| 2673 | 2684 |
| 2674 if (cons_free_list) | 2685 if (cons_free_list) |
| 2675 { | 2686 { |
| 2676 /* We use the cdr for chaining the free list | 2687 /* We use the cdr for chaining the free list |
| 2677 so that we won't use the same field that has the mark bit. */ | 2688 so that we won't use the same field that has the mark bit. */ |
| 2849 a dumped Emacs. */ | 2860 a dumped Emacs. */ |
| 2850 BLOCK_INPUT; | 2861 BLOCK_INPUT; |
| 2851 mallopt (M_MMAP_MAX, 0); | 2862 mallopt (M_MMAP_MAX, 0); |
| 2852 UNBLOCK_INPUT; | 2863 UNBLOCK_INPUT; |
| 2853 #endif | 2864 #endif |
| 2865 | |
| 2866 /* This gets triggered by code which I haven't bothered to fix. --Stef */ | |
| 2867 /* eassert (!handling_signal); */ | |
| 2854 | 2868 |
| 2855 nbytes = sizeof *p + (len - 1) * sizeof p->contents[0]; | 2869 nbytes = sizeof *p + (len - 1) * sizeof p->contents[0]; |
| 2856 p = (struct Lisp_Vector *) lisp_malloc (nbytes, type); | 2870 p = (struct Lisp_Vector *) lisp_malloc (nbytes, type); |
| 2857 | 2871 |
| 2858 #ifdef DOUG_LEA_MALLOC | 2872 #ifdef DOUG_LEA_MALLOC |
| 3143 register Lisp_Object val; | 3157 register Lisp_Object val; |
| 3144 register struct Lisp_Symbol *p; | 3158 register struct Lisp_Symbol *p; |
| 3145 | 3159 |
| 3146 CHECK_STRING (name); | 3160 CHECK_STRING (name); |
| 3147 | 3161 |
| 3162 eassert (!handling_signal); | |
| 3163 | |
| 3148 if (symbol_free_list) | 3164 if (symbol_free_list) |
| 3149 { | 3165 { |
| 3150 XSETSYMBOL (val, symbol_free_list); | 3166 XSETSYMBOL (val, symbol_free_list); |
| 3151 symbol_free_list = symbol_free_list->next; | 3167 symbol_free_list = symbol_free_list->next; |
| 3152 } | 3168 } |
| 3222 | 3238 |
| 3223 Lisp_Object | 3239 Lisp_Object |
| 3224 allocate_misc () | 3240 allocate_misc () |
| 3225 { | 3241 { |
| 3226 Lisp_Object val; | 3242 Lisp_Object val; |
| 3243 | |
| 3244 eassert (!handling_signal); | |
| 3227 | 3245 |
| 3228 if (marker_free_list) | 3246 if (marker_free_list) |
| 3229 { | 3247 { |
| 3230 XSETMISC (val, marker_free_list); | 3248 XSETMISC (val, marker_free_list); |
| 3231 marker_free_list = marker_free_list->u_free.chain; | 3249 marker_free_list = marker_free_list->u_free.chain; |
