emacs-devel
[Top][All Lists]
Advanced

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

Re: GC crashes


From: Kenichi Handa
Subject: Re: GC crashes
Date: Mon, 8 Dec 2003 15:05:01 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <jwvptezopsx.fsf-monnier+emacs/address@hidden>, Stefan Monnier 
<address@hidden> writes:
> You said that the value associated with each key is always
> an integer, right?  In that case, the value is always
> survive_gc_p, so it will never cause the key&value pair to
> be removed, 

??? See this code of sweep_weak_table (in fns.c).

      for (idx = HASH_INDEX (h, bucket); !GC_NILP (idx); idx = next)
        {
          int i = XFASTINT (idx);
          int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
          int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
          int remove_p;

          if (EQ (h->weak, Qkey))
            remove_p = !key_known_to_survive_p;
          else if (EQ (h->weak, Qvalue))
            remove_p = !value_known_to_survive_p;
          else if (EQ (h->weak, Qkey_or_value))
            remove_p = !(key_known_to_survive_p || value_known_to_survive_p);
          else if (EQ (h->weak, Qkey_and_value))
            remove_p = !(key_known_to_survive_p && value_known_to_survive_p);
          else
            abort ();

If h->weak is Qkey, it sets remove_p only by checking
key_known_to_survive_p.  So, it seems that wether the value
survives GC or not doesn't matter in this case.

---
Ken'ichi HANDA
address@hidden




reply via email to

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