aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-06 21:05:09 +0000
committerGerd Moellmann2000-12-06 21:05:09 +0000
commitd285b373956fbe32141a491729cd84f190413e17 (patch)
treef5709dc42f5bffa0c60c8ecb2c36661c94bf29a3 /src/alloc.c
parentfbd9f2769958be3d1610e5d89156f07dbd2dab88 (diff)
downloademacs-d285b373956fbe32141a491729cd84f190413e17.tar.gz
emacs-d285b373956fbe32141a491729cd84f190413e17.zip
(gc_sweep): Prevent symbols read during loadup
from being freed.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 23ab3a3bcd2..83007657e20 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4764,29 +4764,36 @@ gc_sweep ()
4764 register int lim = symbol_block_index; 4764 register int lim = symbol_block_index;
4765 register int num_free = 0, num_used = 0; 4765 register int num_free = 0, num_used = 0;
4766 4766
4767 symbol_free_list = 0; 4767 symbol_free_list = NULL;
4768 4768
4769 for (sblk = symbol_block; sblk; sblk = *sprev) 4769 for (sblk = symbol_block; sblk; sblk = *sprev)
4770 { 4770 {
4771 register int i;
4772 int this_free = 0; 4771 int this_free = 0;
4773 for (i = 0; i < lim; i++) 4772 struct Lisp_Symbol *sym = sblk->symbols;
4774 if (!XMARKBIT (sblk->symbols[i].plist)) 4773 struct Lisp_Symbol *end = sym + lim;
4775 { 4774
4776 *(struct Lisp_Symbol **)&sblk->symbols[i].value = symbol_free_list; 4775 for (; sym < end; ++sym)
4777 symbol_free_list = &sblk->symbols[i]; 4776 {
4777 int pure_p = PURE_POINTER_P (sym->name);
4778
4779 if (!XMARKBIT (sym->plist) && !pure_p)
4780 {
4781 *(struct Lisp_Symbol **) &sym->value = symbol_free_list;
4782 symbol_free_list = sym;
4778#if GC_MARK_STACK 4783#if GC_MARK_STACK
4779 symbol_free_list->function = Vdead; 4784 symbol_free_list->function = Vdead;
4780#endif 4785#endif
4781 this_free++; 4786 ++this_free;
4782 } 4787 }
4783 else 4788 else
4784 { 4789 {
4785 num_used++; 4790 ++num_used;
4786 if (!PURE_POINTER_P (sblk->symbols[i].name)) 4791 if (!pure_p)
4787 UNMARK_STRING (sblk->symbols[i].name); 4792 UNMARK_STRING (sym->name);
4788 XUNMARK (sblk->symbols[i].plist); 4793 XUNMARK (sym->plist);
4789 } 4794 }
4795 }
4796
4790 lim = SYMBOL_BLOCK_SIZE; 4797 lim = SYMBOL_BLOCK_SIZE;
4791 /* If this block contains only free symbols and we have already 4798 /* If this block contains only free symbols and we have already
4792 seen more than two blocks worth of free symbols then deallocate 4799 seen more than two blocks worth of free symbols then deallocate