diff options
| author | Stefan Monnier | 2007-09-29 20:19:41 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-29 20:19:41 +0000 |
| commit | 9c545a55349f4edc19da0fa54e1e3f822ce04b61 (patch) | |
| tree | 9abceeaad52af3ab04765b1430e282919bc94c25 /src | |
| parent | dafc79fa1bc62a089e613b5f9753df3789bdfce2 (diff) | |
| download | emacs-9c545a55349f4edc19da0fa54e1e3f822ce04b61.tar.gz emacs-9c545a55349f4edc19da0fa54e1e3f822ce04b61.zip | |
(enum mem_type): Replace all vector subtypes -> MEM_TYPE_VECTORLIKE.
(allocate_vectorlike): Remove type argument. Adjust callers.
(live_vector_p, mark_maybe_pointer, valid_lisp_object_p):
Only handle the one remaining MEM_TYPE_VECTORLIKE.
(mark_terminal): Remove left-over declaration.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/alloc.c | 54 |
2 files changed, 24 insertions, 36 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 33d82ad9b6c..0d6fadaefec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2007-09-29 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-09-29 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * alloc.c (mark_terminal): Remove left-over declaration. | ||
| 4 | (enum mem_type): Replace all vector subtypes -> MEM_TYPE_VECTORLIKE. | ||
| 5 | (allocate_vectorlike): Remove type argument. Adjust callers. | ||
| 6 | (live_vector_p, mark_maybe_pointer, valid_lisp_object_p): | ||
| 7 | Only handle the one remaining MEM_TYPE_VECTORLIKE. | ||
| 8 | |||
| 3 | * alloc.c (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): New macros | 9 | * alloc.c (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): New macros |
| 4 | to avoid unnecessary BLOCK_INPUTs when SYNC_INPUT is used. | 10 | to avoid unnecessary BLOCK_INPUTs when SYNC_INPUT is used. |
| 5 | (xmalloc, xrealloc, xfree, lisp_malloc, lisp_free, lisp_align_malloc) | 11 | (xmalloc, xrealloc, xfree, lisp_malloc, lisp_free, lisp_align_malloc) |
diff --git a/src/alloc.c b/src/alloc.c index 245716fe06c..0d64bf66663 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -342,7 +342,6 @@ Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */ | |||
| 342 | EMACS_INT gcs_done; /* accumulated GCs */ | 342 | EMACS_INT gcs_done; /* accumulated GCs */ |
| 343 | 343 | ||
| 344 | static void mark_buffer P_ ((Lisp_Object)); | 344 | static void mark_buffer P_ ((Lisp_Object)); |
| 345 | static void mark_terminal P_((struct terminal *t)); | ||
| 346 | static void mark_terminals P_ ((void)); | 345 | static void mark_terminals P_ ((void)); |
| 347 | extern void mark_kboards P_ ((void)); | 346 | extern void mark_kboards P_ ((void)); |
| 348 | extern void mark_ttys P_ ((void)); | 347 | extern void mark_ttys P_ ((void)); |
| @@ -377,15 +376,11 @@ enum mem_type | |||
| 377 | MEM_TYPE_MISC, | 376 | MEM_TYPE_MISC, |
| 378 | MEM_TYPE_SYMBOL, | 377 | MEM_TYPE_SYMBOL, |
| 379 | MEM_TYPE_FLOAT, | 378 | MEM_TYPE_FLOAT, |
| 380 | /* Keep the following vector-like types together, with | 379 | /* We used to keep separate mem_types for subtypes of vectors such as |
| 381 | MEM_TYPE_WINDOW being the last, and MEM_TYPE_VECTOR the | 380 | process, hash_table, frame, terminal, and window, but we never made |
| 382 | first. Or change the code of live_vector_p, for instance. */ | 381 | use of the distinction, so it only caused source-code complexity |
| 383 | MEM_TYPE_VECTOR, | 382 | and runtime slowdown. Minor but pointless. */ |
| 384 | MEM_TYPE_PROCESS, | 383 | MEM_TYPE_VECTORLIKE |
| 385 | MEM_TYPE_HASH_TABLE, | ||
| 386 | MEM_TYPE_FRAME, | ||
| 387 | MEM_TYPE_TERMINAL, | ||
| 388 | MEM_TYPE_WINDOW | ||
| 389 | }; | 384 | }; |
| 390 | 385 | ||
| 391 | static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); | 386 | static POINTER_TYPE *lisp_align_malloc P_ ((size_t, enum mem_type)); |
| @@ -472,7 +467,7 @@ static struct mem_node mem_z; | |||
| 472 | #define MEM_NIL &mem_z | 467 | #define MEM_NIL &mem_z |
| 473 | 468 | ||
| 474 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); | 469 | static POINTER_TYPE *lisp_malloc P_ ((size_t, enum mem_type)); |
| 475 | static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT, enum mem_type)); | 470 | static struct Lisp_Vector *allocate_vectorlike P_ ((EMACS_INT)); |
| 476 | static void lisp_free P_ ((POINTER_TYPE *)); | 471 | static void lisp_free P_ ((POINTER_TYPE *)); |
| 477 | static void mark_stack P_ ((void)); | 472 | static void mark_stack P_ ((void)); |
| 478 | static int live_vector_p P_ ((struct mem_node *, void *)); | 473 | static int live_vector_p P_ ((struct mem_node *, void *)); |
| @@ -2915,9 +2910,8 @@ int n_vectors; | |||
| 2915 | with room for LEN Lisp_Objects. */ | 2910 | with room for LEN Lisp_Objects. */ |
| 2916 | 2911 | ||
| 2917 | static struct Lisp_Vector * | 2912 | static struct Lisp_Vector * |
| 2918 | allocate_vectorlike (len, type) | 2913 | allocate_vectorlike (len) |
| 2919 | EMACS_INT len; | 2914 | EMACS_INT len; |
| 2920 | enum mem_type type; | ||
| 2921 | { | 2915 | { |
| 2922 | struct Lisp_Vector *p; | 2916 | struct Lisp_Vector *p; |
| 2923 | size_t nbytes; | 2917 | size_t nbytes; |
| @@ -2935,7 +2929,7 @@ allocate_vectorlike (len, type) | |||
| 2935 | /* eassert (!handling_signal); */ | 2929 | /* eassert (!handling_signal); */ |
| 2936 | 2930 | ||
| 2937 | nbytes = sizeof *p + (len - 1) * sizeof p->contents[0]; | 2931 | nbytes = sizeof *p + (len - 1) * sizeof p->contents[0]; |
| 2938 | p = (struct Lisp_Vector *) lisp_malloc (nbytes, type); | 2932 | p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); |
| 2939 | 2933 | ||
| 2940 | #ifdef DOUG_LEA_MALLOC | 2934 | #ifdef DOUG_LEA_MALLOC |
| 2941 | /* Back to a reasonable maximum of mmap'ed areas. */ | 2935 | /* Back to a reasonable maximum of mmap'ed areas. */ |
| @@ -2961,7 +2955,7 @@ struct Lisp_Vector * | |||
| 2961 | allocate_vector (nslots) | 2955 | allocate_vector (nslots) |
| 2962 | EMACS_INT nslots; | 2956 | EMACS_INT nslots; |
| 2963 | { | 2957 | { |
| 2964 | struct Lisp_Vector *v = allocate_vectorlike (nslots, MEM_TYPE_VECTOR); | 2958 | struct Lisp_Vector *v = allocate_vectorlike (nslots); |
| 2965 | v->size = nslots; | 2959 | v->size = nslots; |
| 2966 | return v; | 2960 | return v; |
| 2967 | } | 2961 | } |
| @@ -2973,7 +2967,7 @@ struct Lisp_Hash_Table * | |||
| 2973 | allocate_hash_table () | 2967 | allocate_hash_table () |
| 2974 | { | 2968 | { |
| 2975 | EMACS_INT len = VECSIZE (struct Lisp_Hash_Table); | 2969 | EMACS_INT len = VECSIZE (struct Lisp_Hash_Table); |
| 2976 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_HASH_TABLE); | 2970 | struct Lisp_Vector *v = allocate_vectorlike (len); |
| 2977 | EMACS_INT i; | 2971 | EMACS_INT i; |
| 2978 | 2972 | ||
| 2979 | v->size = len; | 2973 | v->size = len; |
| @@ -2988,7 +2982,7 @@ struct window * | |||
| 2988 | allocate_window () | 2982 | allocate_window () |
| 2989 | { | 2983 | { |
| 2990 | EMACS_INT len = VECSIZE (struct window); | 2984 | EMACS_INT len = VECSIZE (struct window); |
| 2991 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_WINDOW); | 2985 | struct Lisp_Vector *v = allocate_vectorlike (len); |
| 2992 | EMACS_INT i; | 2986 | EMACS_INT i; |
| 2993 | 2987 | ||
| 2994 | for (i = 0; i < len; ++i) | 2988 | for (i = 0; i < len; ++i) |
| @@ -3007,7 +3001,7 @@ allocate_terminal () | |||
| 3007 | /* Size if we only count the actual Lisp_Object fields (which need to be | 3001 | /* Size if we only count the actual Lisp_Object fields (which need to be |
| 3008 | traced by the GC). */ | 3002 | traced by the GC). */ |
| 3009 | EMACS_INT lisplen = PSEUDOVECSIZE (struct terminal, next_terminal); | 3003 | EMACS_INT lisplen = PSEUDOVECSIZE (struct terminal, next_terminal); |
| 3010 | struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_TERMINAL); | 3004 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 3011 | EMACS_INT i; | 3005 | EMACS_INT i; |
| 3012 | Lisp_Object tmp, zero = make_number (0); | 3006 | Lisp_Object tmp, zero = make_number (0); |
| 3013 | 3007 | ||
| @@ -3025,7 +3019,7 @@ struct frame * | |||
| 3025 | allocate_frame () | 3019 | allocate_frame () |
| 3026 | { | 3020 | { |
| 3027 | EMACS_INT len = VECSIZE (struct frame); | 3021 | EMACS_INT len = VECSIZE (struct frame); |
| 3028 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_FRAME); | 3022 | struct Lisp_Vector *v = allocate_vectorlike (len); |
| 3029 | EMACS_INT i; | 3023 | EMACS_INT i; |
| 3030 | 3024 | ||
| 3031 | for (i = 0; i < len; ++i) | 3025 | for (i = 0; i < len; ++i) |
| @@ -3043,7 +3037,7 @@ allocate_process () | |||
| 3043 | /* Size if we only count the actual Lisp_Object fields (which need to be | 3037 | /* Size if we only count the actual Lisp_Object fields (which need to be |
| 3044 | traced by the GC). */ | 3038 | traced by the GC). */ |
| 3045 | EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); | 3039 | EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid); |
| 3046 | struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS); | 3040 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 3047 | EMACS_INT i; | 3041 | EMACS_INT i; |
| 3048 | 3042 | ||
| 3049 | for (i = 0; i < lisplen; ++i) | 3043 | for (i = 0; i < lisplen; ++i) |
| @@ -3058,7 +3052,7 @@ struct Lisp_Vector * | |||
| 3058 | allocate_other_vector (len) | 3052 | allocate_other_vector (len) |
| 3059 | EMACS_INT len; | 3053 | EMACS_INT len; |
| 3060 | { | 3054 | { |
| 3061 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_VECTOR); | 3055 | struct Lisp_Vector *v = allocate_vectorlike (len); |
| 3062 | EMACS_INT i; | 3056 | EMACS_INT i; |
| 3063 | 3057 | ||
| 3064 | for (i = 0; i < len; ++i) | 3058 | for (i = 0; i < len; ++i) |
| @@ -4112,9 +4106,7 @@ live_vector_p (m, p) | |||
| 4112 | struct mem_node *m; | 4106 | struct mem_node *m; |
| 4113 | void *p; | 4107 | void *p; |
| 4114 | { | 4108 | { |
| 4115 | return (p == m->start | 4109 | return (p == m->start && m->type == MEM_TYPE_VECTORLIKE); |
| 4116 | && m->type >= MEM_TYPE_VECTOR | ||
| 4117 | && m->type <= MEM_TYPE_WINDOW); | ||
| 4118 | } | 4110 | } |
| 4119 | 4111 | ||
| 4120 | 4112 | ||
| @@ -4312,12 +4304,7 @@ mark_maybe_pointer (p) | |||
| 4312 | XSETFLOAT (obj, p); | 4304 | XSETFLOAT (obj, p); |
| 4313 | break; | 4305 | break; |
| 4314 | 4306 | ||
| 4315 | case MEM_TYPE_VECTOR: | 4307 | case MEM_TYPE_VECTORLIKE: |
| 4316 | case MEM_TYPE_PROCESS: | ||
| 4317 | case MEM_TYPE_HASH_TABLE: | ||
| 4318 | case MEM_TYPE_FRAME: | ||
| 4319 | case MEM_TYPE_TERMINAL: | ||
| 4320 | case MEM_TYPE_WINDOW: | ||
| 4321 | if (live_vector_p (m, p)) | 4308 | if (live_vector_p (m, p)) |
| 4322 | { | 4309 | { |
| 4323 | Lisp_Object tem; | 4310 | Lisp_Object tem; |
| @@ -4717,12 +4704,7 @@ valid_lisp_object_p (obj) | |||
| 4717 | case MEM_TYPE_FLOAT: | 4704 | case MEM_TYPE_FLOAT: |
| 4718 | return live_float_p (m, p); | 4705 | return live_float_p (m, p); |
| 4719 | 4706 | ||
| 4720 | case MEM_TYPE_VECTOR: | 4707 | case MEM_TYPE_VECTORLIKE: |
| 4721 | case MEM_TYPE_PROCESS: | ||
| 4722 | case MEM_TYPE_HASH_TABLE: | ||
| 4723 | case MEM_TYPE_FRAME: | ||
| 4724 | case MEM_TYPE_TERMINAL: | ||
| 4725 | case MEM_TYPE_WINDOW: | ||
| 4726 | return live_vector_p (m, p); | 4708 | return live_vector_p (m, p); |
| 4727 | 4709 | ||
| 4728 | default: | 4710 | default: |