[Top][All Lists]

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

Re: GC crashes

From: Stefan Monnier
Subject: Re: GC crashes
Date: 08 Dec 2003 01:25:17 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> 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.

Yes, we agree 100%.  If you passed Qt instead of Qkey, then the entries are
removed if either key or value does not survive, but since your values are
integers, they'll always survive.


reply via email to

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