emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109135: Fix sweep_vectors to handle


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109135: Fix sweep_vectors to handle large bool vectors correctly.
Date: Wed, 18 Jul 2012 13:46:07 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109135
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-18 13:46:07 +0400
message:
  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.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-18 08:11:08 +0000
+++ b/src/ChangeLog     2012-07-18 09:46:07 +0000
@@ -1,3 +1,9 @@
+2012-07-18  Dmitry Antipov  <address@hidden>
+
+       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  <address@hidden>
 
        * frame.c (x_set_frame_parameters): Revert bogus change introduced

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-18 05:44:36 +0000
+++ b/src/alloc.c       2012-07-18 09:46:07 +0000
@@ -3152,11 +3152,27 @@
        {
          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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]