diff options
| author | Chong Yidong | 2006-01-27 22:14:57 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-01-27 22:14:57 +0000 |
| commit | e2984df0efddfad2d20cc550f120fc6053745bd1 (patch) | |
| tree | cdedb8f9fd1c5950a17912df7f85b381edc49527 /src/alloc.c | |
| parent | cd7070ada99580bda829ecee804b073bbffed9e3 (diff) | |
| download | emacs-e2984df0efddfad2d20cc550f120fc6053745bd1.tar.gz emacs-e2984df0efddfad2d20cc550f120fc6053745bd1.zip | |
* alloc.c (make_interval, allocate_string)
(allocate_string_data, make_float, Fcons, allocate_vectorlike)
(Fmake_symbol, allocate_misc): Use BLOCK_INPUT when accessing
global variables.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 81 |
1 files changed, 73 insertions, 8 deletions
diff --git a/src/alloc.c b/src/alloc.c index 4d44134e1cd..01c12f954b7 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1422,7 +1422,11 @@ make_interval () | |||
| 1422 | { | 1422 | { |
| 1423 | INTERVAL val; | 1423 | INTERVAL val; |
| 1424 | 1424 | ||
| 1425 | eassert (!handling_signal); | 1425 | /* eassert (!handling_signal); */ |
| 1426 | |||
| 1427 | #ifndef SYNC_INPUT | ||
| 1428 | BLOCK_INPUT; | ||
| 1429 | #endif | ||
| 1426 | 1430 | ||
| 1427 | if (interval_free_list) | 1431 | if (interval_free_list) |
| 1428 | { | 1432 | { |
| @@ -1445,6 +1449,11 @@ make_interval () | |||
| 1445 | } | 1449 | } |
| 1446 | val = &interval_block->intervals[interval_block_index++]; | 1450 | val = &interval_block->intervals[interval_block_index++]; |
| 1447 | } | 1451 | } |
| 1452 | |||
| 1453 | #ifndef SYNC_INPUT | ||
| 1454 | UNBLOCK_INPUT; | ||
| 1455 | #endif | ||
| 1456 | |||
| 1448 | consing_since_gc += sizeof (struct interval); | 1457 | consing_since_gc += sizeof (struct interval); |
| 1449 | intervals_consed++; | 1458 | intervals_consed++; |
| 1450 | RESET_INTERVAL (val); | 1459 | RESET_INTERVAL (val); |
| @@ -1842,7 +1851,11 @@ allocate_string () | |||
| 1842 | { | 1851 | { |
| 1843 | struct Lisp_String *s; | 1852 | struct Lisp_String *s; |
| 1844 | 1853 | ||
| 1845 | eassert (!handling_signal); | 1854 | /* eassert (!handling_signal); */ |
| 1855 | |||
| 1856 | #ifndef SYNC_INPUT | ||
| 1857 | BLOCK_INPUT; | ||
| 1858 | #endif | ||
| 1846 | 1859 | ||
| 1847 | /* If the free-list is empty, allocate a new string_block, and | 1860 | /* If the free-list is empty, allocate a new string_block, and |
| 1848 | add all the Lisp_Strings in it to the free-list. */ | 1861 | add all the Lisp_Strings in it to the free-list. */ |
| @@ -1873,6 +1886,10 @@ allocate_string () | |||
| 1873 | s = string_free_list; | 1886 | s = string_free_list; |
| 1874 | string_free_list = NEXT_FREE_LISP_STRING (s); | 1887 | string_free_list = NEXT_FREE_LISP_STRING (s); |
| 1875 | 1888 | ||
| 1889 | #ifndef SYNC_INPUT | ||
| 1890 | UNBLOCK_INPUT; | ||
| 1891 | #endif | ||
| 1892 | |||
| 1876 | /* Probably not strictly necessary, but play it safe. */ | 1893 | /* Probably not strictly necessary, but play it safe. */ |
| 1877 | bzero (s, sizeof *s); | 1894 | bzero (s, sizeof *s); |
| 1878 | 1895 | ||
| @@ -1920,6 +1937,12 @@ allocate_string_data (s, nchars, nbytes) | |||
| 1920 | /* Determine the number of bytes needed to store NBYTES bytes | 1937 | /* Determine the number of bytes needed to store NBYTES bytes |
| 1921 | of string data. */ | 1938 | of string data. */ |
| 1922 | needed = SDATA_SIZE (nbytes); | 1939 | needed = SDATA_SIZE (nbytes); |
| 1940 | old_data = s->data ? SDATA_OF_STRING (s) : NULL; | ||
| 1941 | old_nbytes = GC_STRING_BYTES (s); | ||
| 1942 | |||
| 1943 | #ifndef SYNC_INPUT | ||
| 1944 | BLOCK_INPUT; | ||
| 1945 | #endif | ||
| 1923 | 1946 | ||
| 1924 | if (nbytes > LARGE_STRING_BYTES) | 1947 | if (nbytes > LARGE_STRING_BYTES) |
| 1925 | { | 1948 | { |
| @@ -1974,12 +1997,13 @@ allocate_string_data (s, nchars, nbytes) | |||
| 1974 | else | 1997 | else |
| 1975 | b = current_sblock; | 1998 | b = current_sblock; |
| 1976 | 1999 | ||
| 1977 | old_data = s->data ? SDATA_OF_STRING (s) : NULL; | ||
| 1978 | old_nbytes = GC_STRING_BYTES (s); | ||
| 1979 | |||
| 1980 | data = b->next_free; | 2000 | data = b->next_free; |
| 1981 | b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA); | 2001 | b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA); |
| 1982 | 2002 | ||
| 2003 | #ifndef SYNC_INPUT | ||
| 2004 | UNBLOCK_INPUT; | ||
| 2005 | #endif | ||
| 2006 | |||
| 1983 | data->string = s; | 2007 | data->string = s; |
| 1984 | s->data = SDATA_DATA (data); | 2008 | s->data = SDATA_DATA (data); |
| 1985 | #ifdef GC_CHECK_STRING_BYTES | 2009 | #ifdef GC_CHECK_STRING_BYTES |
| @@ -2560,7 +2584,11 @@ make_float (float_value) | |||
| 2560 | { | 2584 | { |
| 2561 | register Lisp_Object val; | 2585 | register Lisp_Object val; |
| 2562 | 2586 | ||
| 2563 | eassert (!handling_signal); | 2587 | /* eassert (!handling_signal); */ |
| 2588 | |||
| 2589 | #ifndef SYNC_INPUT | ||
| 2590 | BLOCK_INPUT; | ||
| 2591 | #endif | ||
| 2564 | 2592 | ||
| 2565 | if (float_free_list) | 2593 | if (float_free_list) |
| 2566 | { | 2594 | { |
| @@ -2587,6 +2615,10 @@ make_float (float_value) | |||
| 2587 | float_block_index++; | 2615 | float_block_index++; |
| 2588 | } | 2616 | } |
| 2589 | 2617 | ||
| 2618 | #ifndef SYNC_INPUT | ||
| 2619 | UNBLOCK_INPUT; | ||
| 2620 | #endif | ||
| 2621 | |||
| 2590 | XFLOAT_DATA (val) = float_value; | 2622 | XFLOAT_DATA (val) = float_value; |
| 2591 | eassert (!FLOAT_MARKED_P (XFLOAT (val))); | 2623 | eassert (!FLOAT_MARKED_P (XFLOAT (val))); |
| 2592 | consing_since_gc += sizeof (struct Lisp_Float); | 2624 | consing_since_gc += sizeof (struct Lisp_Float); |
| @@ -2681,7 +2713,11 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2681 | { | 2713 | { |
| 2682 | register Lisp_Object val; | 2714 | register Lisp_Object val; |
| 2683 | 2715 | ||
| 2684 | eassert (!handling_signal); | 2716 | /* eassert (!handling_signal); */ |
| 2717 | |||
| 2718 | #ifndef SYNC_INPUT | ||
| 2719 | BLOCK_INPUT; | ||
| 2720 | #endif | ||
| 2685 | 2721 | ||
| 2686 | if (cons_free_list) | 2722 | if (cons_free_list) |
| 2687 | { | 2723 | { |
| @@ -2707,6 +2743,10 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2707 | cons_block_index++; | 2743 | cons_block_index++; |
| 2708 | } | 2744 | } |
| 2709 | 2745 | ||
| 2746 | #ifndef SYNC_INPUT | ||
| 2747 | UNBLOCK_INPUT; | ||
| 2748 | #endif | ||
| 2749 | |||
| 2710 | XSETCAR (val, car); | 2750 | XSETCAR (val, car); |
| 2711 | XSETCDR (val, cdr); | 2751 | XSETCDR (val, cdr); |
| 2712 | eassert (!CONS_MARKED_P (XCONS (val))); | 2752 | eassert (!CONS_MARKED_P (XCONS (val))); |
| @@ -2880,8 +2920,17 @@ allocate_vectorlike (len, type) | |||
| 2880 | consing_since_gc += nbytes; | 2920 | consing_since_gc += nbytes; |
| 2881 | vector_cells_consed += len; | 2921 | vector_cells_consed += len; |
| 2882 | 2922 | ||
| 2923 | #ifndef SYNC_INPUT | ||
| 2924 | BLOCK_INPUT; | ||
| 2925 | #endif | ||
| 2926 | |||
| 2883 | p->next = all_vectors; | 2927 | p->next = all_vectors; |
| 2884 | all_vectors = p; | 2928 | all_vectors = p; |
| 2929 | |||
| 2930 | #ifndef SYNC_INPUT | ||
| 2931 | UNBLOCK_INPUT; | ||
| 2932 | #endif | ||
| 2933 | |||
| 2885 | ++n_vectors; | 2934 | ++n_vectors; |
| 2886 | return p; | 2935 | return p; |
| 2887 | } | 2936 | } |
| @@ -3162,6 +3211,10 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3162 | 3211 | ||
| 3163 | eassert (!handling_signal); | 3212 | eassert (!handling_signal); |
| 3164 | 3213 | ||
| 3214 | #ifndef SYNC_INPUT | ||
| 3215 | BLOCK_INPUT; | ||
| 3216 | #endif | ||
| 3217 | |||
| 3165 | if (symbol_free_list) | 3218 | if (symbol_free_list) |
| 3166 | { | 3219 | { |
| 3167 | XSETSYMBOL (val, symbol_free_list); | 3220 | XSETSYMBOL (val, symbol_free_list); |
| @@ -3183,6 +3236,10 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3183 | symbol_block_index++; | 3236 | symbol_block_index++; |
| 3184 | } | 3237 | } |
| 3185 | 3238 | ||
| 3239 | #ifndef SYNC_INPUT | ||
| 3240 | UNBLOCK_INPUT; | ||
| 3241 | #endif | ||
| 3242 | |||
| 3186 | p = XSYMBOL (val); | 3243 | p = XSYMBOL (val); |
| 3187 | p->xname = name; | 3244 | p->xname = name; |
| 3188 | p->plist = Qnil; | 3245 | p->plist = Qnil; |
| @@ -3242,7 +3299,11 @@ allocate_misc () | |||
| 3242 | { | 3299 | { |
| 3243 | Lisp_Object val; | 3300 | Lisp_Object val; |
| 3244 | 3301 | ||
| 3245 | eassert (!handling_signal); | 3302 | /* eassert (!handling_signal); */ |
| 3303 | |||
| 3304 | #ifndef SYNC_INPUT | ||
| 3305 | BLOCK_INPUT; | ||
| 3306 | #endif | ||
| 3246 | 3307 | ||
| 3247 | if (marker_free_list) | 3308 | if (marker_free_list) |
| 3248 | { | 3309 | { |
| @@ -3266,6 +3327,10 @@ allocate_misc () | |||
| 3266 | marker_block_index++; | 3327 | marker_block_index++; |
| 3267 | } | 3328 | } |
| 3268 | 3329 | ||
| 3330 | #ifndef SYNC_INPUT | ||
| 3331 | UNBLOCK_INPUT; | ||
| 3332 | #endif | ||
| 3333 | |||
| 3269 | --total_free_markers; | 3334 | --total_free_markers; |
| 3270 | consing_since_gc += sizeof (union Lisp_Misc); | 3335 | consing_since_gc += sizeof (union Lisp_Misc); |
| 3271 | misc_objects_consed++; | 3336 | misc_objects_consed++; |