]> git.eshelyaron.com Git - emacs.git/commitdiff
(sweep_weak_table): Mark only objects that are not
authorGerd Moellmann <gerd@gnu.org>
Mon, 3 Jul 2000 12:29:36 +0000 (12:29 +0000)
committerGerd Moellmann <gerd@gnu.org>
Mon, 3 Jul 2000 12:29:36 +0000 (12:29 +0000)
marked already.

src/ChangeLog
src/fns.c

index 9e30bff41912e2261968bf60e47fe4d80ec1f037..1bc2bf0b8bb4516b2e7ab929a672a622d61407bf 100644 (file)
@@ -1,5 +1,8 @@
 2000-07-03  Gerd Moellmann  <gerd@gnu.org>
 
+       * fns.c (sweep_weak_table): Mark only objects that are not 
+       marked already.
+
        * frame.c (next_frame, prev_frame): If MINIBUF is a window,
        include those frames as candidates which have their focus
        redirected to the minibuffer frame.
index 24107f2ddeb1bcf5d267b106fc0a6fb591d6ce2e..680fec8cc62f31c465d56f7045f3285d430cf2ac 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -4175,14 +4175,17 @@ sweep_weak_table (h, remove_entries_p)
          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 @@ sweep_weak_table (h, remove_entries_p)
              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;
+                   }
                }
            }