Fix sweep_vectors to handle large bool vectors correctly.
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 18 Jul 2012 09:46:07 +0000 (13:46 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 18 Jul 2012 09:46:07 +0000 (13:46 +0400)
* alloc.c (sweep_vectors): Account total_vector_bytes for
bool vectors larger than VBLOCK_BYTES_MAX.

src/ChangeLog
src/alloc.c

index 368c07f..26199d8 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-18  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix sweep_vectors to handle large bool vectors correctly.
+       * alloc.c (sweep_vectors): Account total_vector_bytes for
+       bool vectors larger than VBLOCK_BYTES_MAX.
+
 2012-07-18  Chong Yidong  <cyd@gnu.org>
 
        * frame.c (x_set_frame_parameters): Revert bogus change introduced
index b891d32..0c3f5de 100644 (file)
@@ -3152,11 +3152,27 @@ sweep_vectors (void)
        {
          VECTOR_UNMARK (vector);
          total_vectors++;
-         /* All pseudovectors are small enough to be allocated from
-            vector blocks.  This code should be redesigned if some
-            pseudovector type grows beyond VBLOCK_BYTES_MAX.  */
-         eassert (!(vector->header.size & PSEUDOVECTOR_FLAG));
-         total_vector_bytes += header_size + vector->header.size * word_size;
+         if (vector->header.size & PSEUDOVECTOR_FLAG)
+           {
+             if (((vector->header.size & PVEC_TYPE_MASK)
+                  >> PSEUDOVECTOR_SIZE_BITS) == PVEC_BOOL_VECTOR)
+               {
+                 struct Lisp_Bool_Vector *b
+                   = (struct Lisp_Bool_Vector *) vector;
+                 total_vector_bytes += header_size + sizeof (b->size)
+                   + (b->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+                   / BOOL_VECTOR_BITS_PER_CHAR;
+               }
+             else
+               /* All other pseudovectors are small enough to be
+                  allocated from vector blocks.  This code should
+                  be redesigned if some pseudovector type grows
+                  beyond VBLOCK_BYTES_MAX.  */
+               abort ();
+           }
+         else
+           total_vector_bytes
+             += header_size + vector->header.size * word_size;
          vprev = &vector->header.next.vector;
        }
       else