aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2007-09-23 15:39:16 +0000
committerRichard M. Stallman2007-09-23 15:39:16 +0000
commit3ae2e3a37fae680f44f23170cc06d160d694b831 (patch)
tree8866e4ca5115eb6f396cb8919c01492b250a166c /src
parente32725a7f4b176c46cbe62a8ba697ecac30205c2 (diff)
downloademacs-3ae2e3a37fae680f44f23170cc06d160d694b831.tar.gz
emacs-3ae2e3a37fae680f44f23170cc06d160d694b831.zip
(gc_sweep): Check cons cell mark bits word by word
and optimize the case where they are all 1.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/alloc.c56
2 files changed, 50 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1ee960f80c4..8356d0ea04f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,8 +1,13 @@
12007-09-23 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * alloc.c (gc_sweep): Check cons cell mark bits word by word
4 and optimize the case where they are all 1.
5
12007-09-23 Johannes Weiner <hannes@saeurebad.de> 62007-09-23 Johannes Weiner <hannes@saeurebad.de>
2 7
3 * lisp.h (abs): Define if unknown. 8 * lisp.h (abs): Define if not defined.
4 * keyboard.c, sound.c, w32term.c, xfaces.c, xterm.c: Don't 9 * keyboard.c, sound.c, w32term.c, xfaces.c, xterm.c:
5 define abs now it's in lisp.h. 10 Don't define `abs', since it's defined in lisp.h.
6 11
72007-09-22 Eli Zaretskii <eliz@gnu.org> 122007-09-22 Eli Zaretskii <eliz@gnu.org>
8 13
diff --git a/src/alloc.c b/src/alloc.c
index 2599d5c8ad8..9ba21c2c47a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6028,23 +6028,51 @@ gc_sweep ()
6028 6028
6029 for (cblk = cons_block; cblk; cblk = *cprev) 6029 for (cblk = cons_block; cblk; cblk = *cprev)
6030 { 6030 {
6031 register int i; 6031 register int i = 0;
6032 int this_free = 0; 6032 int this_free = 0;
6033 for (i = 0; i < lim; i++) 6033 int ilim = (lim + BITS_PER_INT - 1) / BITS_PER_INT;
6034 if (!CONS_MARKED_P (&cblk->conses[i])) 6034
6035 { 6035 /* Scan the mark bits an int at a time. */
6036 this_free++; 6036 for (i = 0; i <= ilim; i++)
6037 cblk->conses[i].u.chain = cons_free_list; 6037 {
6038 cons_free_list = &cblk->conses[i]; 6038 if (cblk->gcmarkbits[i] == -1)
6039 {
6040 /* Fast path - all cons cells for this int are marked. */
6041 cblk->gcmarkbits[i] = 0;
6042 num_used += BITS_PER_INT;
6043 }
6044 else
6045 {
6046 /* Some cons cells for this int are not marked.
6047 Find which ones, and free them. */
6048 int start, pos, stop;
6049
6050 start = i * BITS_PER_INT;
6051 stop = lim - start;
6052 if (stop > BITS_PER_INT)
6053 stop = BITS_PER_INT;
6054 stop += start;
6055
6056 for (pos = start; pos < stop; pos++)
6057 {
6058 if (!CONS_MARKED_P (&cblk->conses[pos]))
6059 {
6060 this_free++;
6061 cblk->conses[pos].u.chain = cons_free_list;
6062 cons_free_list = &cblk->conses[pos];
6039#if GC_MARK_STACK 6063#if GC_MARK_STACK
6040 cons_free_list->car = Vdead; 6064 cons_free_list->car = Vdead;
6041#endif 6065#endif
6042 } 6066 }
6043 else 6067 else
6044 { 6068 {
6045 num_used++; 6069 num_used++;
6046 CONS_UNMARK (&cblk->conses[i]); 6070 CONS_UNMARK (&cblk->conses[pos]);
6047 } 6071 }
6072 }
6073 }
6074 }
6075
6048 lim = CONS_BLOCK_SIZE; 6076 lim = CONS_BLOCK_SIZE;
6049 /* If this block contains only free conses and we have already 6077 /* If this block contains only free conses and we have already
6050 seen more than two blocks worth of free conses then deallocate 6078 seen more than two blocks worth of free conses then deallocate