mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
(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.
This commit is contained in:
parent
ff16b87572
commit
13559ee0bb
@ -1,5 +1,11 @@
|
||||
2007-09-27 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* alloc.c (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.
|
||||
|
||||
* termhooks.h (struct terminal): Move all Lisp_Object fields traced by
|
||||
the GC to the beginning.
|
||||
|
||||
|
30
src/alloc.c
30
src/alloc.c
@ -3023,14 +3023,20 @@ allocate_window ()
|
||||
struct terminal *
|
||||
allocate_terminal ()
|
||||
{
|
||||
EMACS_INT len = VECSIZE (struct terminal);
|
||||
struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_TERMINAL);
|
||||
/* Memory-footprint of the object in nb of Lisp_Object fields. */
|
||||
EMACS_INT memlen = VECSIZE (struct terminal);
|
||||
/* Size if we only count the actual Lisp_Object fields (which need to be
|
||||
traced by the GC). */
|
||||
EMACS_INT lisplen = PSEUDOVECSIZE (struct terminal, next_terminal);
|
||||
struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_TERMINAL);
|
||||
EMACS_INT i;
|
||||
Lisp_Object tmp, zero = make_number (0);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
for (i = 0; i < lisplen; ++i)
|
||||
v->contents[i] = Qnil;
|
||||
for (;i < memlen; ++i)
|
||||
v->contents[i] = zero;
|
||||
v->size = len;
|
||||
v->size = lisplen; /* Only trace the Lisp fields. */
|
||||
XSETTERMINAL (tmp, v); /* Add the appropriate tag. */
|
||||
|
||||
return (struct terminal *) v;
|
||||
@ -5683,11 +5689,6 @@ mark_object (arg)
|
||||
mark_glyph_matrix (w->desired_matrix);
|
||||
}
|
||||
}
|
||||
else if (GC_TERMINALP (obj))
|
||||
{
|
||||
CHECK_LIVE (live_vector_p);
|
||||
mark_terminal (XTERMINAL (obj));
|
||||
}
|
||||
else if (GC_HASH_TABLE_P (obj))
|
||||
{
|
||||
struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
|
||||
@ -5934,21 +5935,16 @@ mark_buffer (buf)
|
||||
/* Mark the Lisp pointers in the terminal objects.
|
||||
Called by the Fgarbage_collector. */
|
||||
|
||||
static void
|
||||
mark_terminal (struct terminal *t)
|
||||
{
|
||||
VECTOR_MARK (t);
|
||||
mark_object (t->param_alist);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_terminals (void)
|
||||
{
|
||||
struct terminal *t;
|
||||
Lisp_Object tmp;
|
||||
for (t = terminal_list; t; t = t->next_terminal)
|
||||
{
|
||||
eassert (t->name != NULL);
|
||||
mark_terminal (t);
|
||||
XSETVECTOR (tmp, t);
|
||||
mark_object (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user