changeset 104582:7d47cb148b29

(mark_char_table): New function. (mark_object): Use mark_char_table for a char-table.
author Kenichi Handa <handa@m17n.org>
date Tue, 25 Aug 2009 06:03:09 +0000
parents 03bf18369e45
children e491887d0944
files src/alloc.c
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Tue Aug 25 03:26:40 2009 +0000
+++ b/src/alloc.c	Tue Aug 25 06:03:09 2009 +0000
@@ -5371,6 +5371,34 @@
   return 1;
 }
 
+/* Like mark_vectorlike but optimized for char-tables (and
+   sub-char-tables) assuming that the contents are mostly integers or
+   symbols.  */
+
+static void
+mark_char_table (ptr)
+     struct Lisp_Vector *ptr;
+{
+  register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
+  register int i;
+
+  VECTOR_MARK (ptr);
+  for (i = 0; i < size; i++)
+    {
+      Lisp_Object val = ptr->contents[i];
+
+      if (INTEGERP (val) || SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)
+	continue;
+      if (SUB_CHAR_TABLE_P (val))
+	{
+	  if (! VECTOR_MARKED_P (XVECTOR (val)))
+	    mark_char_table (XVECTOR (val));
+	}
+      else
+	mark_object (val);
+    }
+}
+
 void
 mark_object (arg)
      Lisp_Object arg;
@@ -5533,6 +5561,11 @@
 		VECTOR_MARK (XVECTOR (h->key_and_value));
 	    }
 	}
+      else if (CHAR_TABLE_P (obj))
+	{
+	  if (! VECTOR_MARKED_P (XVECTOR (obj)))
+	    mark_char_table (XVECTOR (obj));
+	}
       else
 	mark_vectorlike (XVECTOR (obj));
       break;