diff options
| author | Stefan Monnier | 2007-09-27 19:51:39 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-27 19:51:39 +0000 |
| commit | 13559ee0bba298a09107f583898c3e02f588627a (patch) | |
| tree | f586e43fedfec6507f535e36a4e92837f48e34a0 /src/alloc.c | |
| parent | ff16b875720e6328cabe271a394a13f60452dcd4 (diff) | |
| download | emacs-13559ee0bba298a09107f583898c3e02f588627a.tar.gz emacs-13559ee0bba298a09107f583898c3e02f588627a.zip | |
(allocate_terminal): Set the vector size to only count the Lisp fields.
Initialize those to nil.
(mark_object): Don't treat terminals specially.
(mark_terminal): Remove.
(mark_terminals): Use mark_object instead.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/alloc.c b/src/alloc.c index 9ba21c2c47a..aada45cd93b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3023,14 +3023,20 @@ allocate_window () | |||
| 3023 | struct terminal * | 3023 | struct terminal * |
| 3024 | allocate_terminal () | 3024 | allocate_terminal () |
| 3025 | { | 3025 | { |
| 3026 | EMACS_INT len = VECSIZE (struct terminal); | 3026 | /* Memory-footprint of the object in nb of Lisp_Object fields. */ |
| 3027 | struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_TERMINAL); | 3027 | EMACS_INT memlen = VECSIZE (struct terminal); |
| 3028 | /* Size if we only count the actual Lisp_Object fields (which need to be | ||
| 3029 | traced by the GC). */ | ||
| 3030 | EMACS_INT lisplen = PSEUDOVECSIZE (struct terminal, next_terminal); | ||
| 3031 | struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_TERMINAL); | ||
| 3028 | EMACS_INT i; | 3032 | EMACS_INT i; |
| 3029 | Lisp_Object tmp, zero = make_number (0); | 3033 | Lisp_Object tmp, zero = make_number (0); |
| 3030 | 3034 | ||
| 3031 | for (i = 0; i < len; ++i) | 3035 | for (i = 0; i < lisplen; ++i) |
| 3036 | v->contents[i] = Qnil; | ||
| 3037 | for (;i < memlen; ++i) | ||
| 3032 | v->contents[i] = zero; | 3038 | v->contents[i] = zero; |
| 3033 | v->size = len; | 3039 | v->size = lisplen; /* Only trace the Lisp fields. */ |
| 3034 | XSETTERMINAL (tmp, v); /* Add the appropriate tag. */ | 3040 | XSETTERMINAL (tmp, v); /* Add the appropriate tag. */ |
| 3035 | 3041 | ||
| 3036 | return (struct terminal *) v; | 3042 | return (struct terminal *) v; |
| @@ -5683,11 +5689,6 @@ mark_object (arg) | |||
| 5683 | mark_glyph_matrix (w->desired_matrix); | 5689 | mark_glyph_matrix (w->desired_matrix); |
| 5684 | } | 5690 | } |
| 5685 | } | 5691 | } |
| 5686 | else if (GC_TERMINALP (obj)) | ||
| 5687 | { | ||
| 5688 | CHECK_LIVE (live_vector_p); | ||
| 5689 | mark_terminal (XTERMINAL (obj)); | ||
| 5690 | } | ||
| 5691 | else if (GC_HASH_TABLE_P (obj)) | 5692 | else if (GC_HASH_TABLE_P (obj)) |
| 5692 | { | 5693 | { |
| 5693 | struct Lisp_Hash_Table *h = XHASH_TABLE (obj); | 5694 | struct Lisp_Hash_Table *h = XHASH_TABLE (obj); |
| @@ -5935,20 +5936,15 @@ mark_buffer (buf) | |||
| 5935 | Called by the Fgarbage_collector. */ | 5936 | Called by the Fgarbage_collector. */ |
| 5936 | 5937 | ||
| 5937 | static void | 5938 | static void |
| 5938 | mark_terminal (struct terminal *t) | ||
| 5939 | { | ||
| 5940 | VECTOR_MARK (t); | ||
| 5941 | mark_object (t->param_alist); | ||
| 5942 | } | ||
| 5943 | |||
| 5944 | static void | ||
| 5945 | mark_terminals (void) | 5939 | mark_terminals (void) |
| 5946 | { | 5940 | { |
| 5947 | struct terminal *t; | 5941 | struct terminal *t; |
| 5942 | Lisp_Object tmp; | ||
| 5948 | for (t = terminal_list; t; t = t->next_terminal) | 5943 | for (t = terminal_list; t; t = t->next_terminal) |
| 5949 | { | 5944 | { |
| 5950 | eassert (t->name != NULL); | 5945 | eassert (t->name != NULL); |
| 5951 | mark_terminal (t); | 5946 | XSETVECTOR (tmp, t); |
| 5947 | mark_object (tmp); | ||
| 5952 | } | 5948 | } |
| 5953 | } | 5949 | } |
| 5954 | 5950 | ||