Mercurial > emacs
changeset 30007:d9c85e2f07ba
(sweep_weak_table): Mark only objects that are not
marked already.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 03 Jul 2000 12:28:41 +0000 |
parents | f39010aa1be6 |
children | 53edba4e0705 |
files | src/fns.c |
diffstat | 1 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Mon Jul 03 09:18:48 2000 +0000 +++ b/src/fns.c Mon Jul 03 12:28:41 2000 +0000 @@ -4175,14 +4175,17 @@ int remove_p; int i = XFASTINT (idx); Lisp_Object next; - + int key_known_to_survive_p, value_known_to_survive_p; + + key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); + value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); + if (EQ (h->weak, Qkey)) - remove_p = !survives_gc_p (HASH_KEY (h, i)); + remove_p = !key_known_to_survive_p; else if (EQ (h->weak, Qvalue)) - remove_p = !survives_gc_p (HASH_VALUE (h, i)); + remove_p = !value_known_to_survive_p; else if (EQ (h->weak, Qt)) - remove_p = (!survives_gc_p (HASH_KEY (h, i)) - || !survives_gc_p (HASH_VALUE (h, i))); + remove_p = !key_known_to_survive_p || !value_known_to_survive_p; else abort (); @@ -4214,9 +4217,17 @@ if (!remove_p) { /* Make sure key and value survive. */ - mark_object (&HASH_KEY (h, i)); - mark_object (&HASH_VALUE (h, i)); - marked = 1; + if (!key_known_to_survive_p) + { + mark_object (&HASH_KEY (h, i)); + marked = 1; + } + + if (!value_known_to_survive_p) + { + mark_object (&HASH_VALUE (h, i)); + marked = 1; + } } }