emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/alloc.c,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c,v
Date: Sun, 23 Sep 2007 15:37:13 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       07/09/23 15:37:13

Index: alloc.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/alloc.c,v
retrieving revision 1.417
retrieving revision 1.418
diff -u -b -r1.417 -r1.418
--- alloc.c     20 Sep 2007 21:28:51 -0000      1.417
+++ alloc.c     23 Sep 2007 15:37:13 -0000      1.418
@@ -6028,14 +6028,38 @@
 
     for (cblk = cons_block; cblk; cblk = *cprev)
       {
-       register int i;
+       register int i = 0;
        int this_free = 0;
-       for (i = 0; i < lim; i++)
-         if (!CONS_MARKED_P (&cblk->conses[i]))
+       int ilim = (lim + BITS_PER_INT - 1) / BITS_PER_INT;
+
+       /* Scan the mark bits an int at a time.  */
+       for (i = 0; i <= ilim; i++)
+         {
+           if (cblk->gcmarkbits[i] == -1)
+             {
+               /* Fast path - all cons cells for this int are marked.  */
+               cblk->gcmarkbits[i] = 0;
+               num_used += BITS_PER_INT;
+             }
+           else
+             {
+               /* Some cons cells for this int are not marked.
+                  Find which ones, and free them.  */
+               int start, pos, stop;
+
+               start = i * BITS_PER_INT;
+               stop = lim - start;
+               if (stop > BITS_PER_INT)
+                 stop = BITS_PER_INT;
+               stop += start;
+
+               for (pos = start; pos < stop; pos++)
+                 {
+                   if (!CONS_MARKED_P (&cblk->conses[pos]))
            {
              this_free++;
-             cblk->conses[i].u.chain = cons_free_list;
-             cons_free_list = &cblk->conses[i];
+                       cblk->conses[pos].u.chain = cons_free_list;
+                       cons_free_list = &cblk->conses[pos];
 #if GC_MARK_STACK
              cons_free_list->car = Vdead;
 #endif
@@ -6043,8 +6067,12 @@
          else
            {
              num_used++;
-             CONS_UNMARK (&cblk->conses[i]);
+                       CONS_UNMARK (&cblk->conses[pos]);
+                     }
            }
+             }
+         }
+
        lim = CONS_BLOCK_SIZE;
        /* If this block contains only free conses and we have already
           seen more than two blocks worth of free conses then deallocate




reply via email to

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