guile-devel
[Top][All Lists]
Advanced

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

SCM_BOOL_F == 0 and BDW-GC


From: Ludovic Courtès
Subject: SCM_BOOL_F == 0 and BDW-GC
Date: Mon, 31 Aug 2009 23:55:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hello!

Neil Jerram <address@hidden> writes:

> Just checking this because Ludovic said recently that (SCM_BOOL_F ==
> 0) would have nice properties for BDW-GC.

Actually he wasn't quite right when he said that.  :-)

The issue with BDW-GC is that "disappearing links" (weak pointers in
libgc parlance) replace pointers to objects that have been reclaimed by
NULL, and there's no way to tell it to use some other value.

That leads to insanities in the weak hash table implementation [0, 1],
which I thought could somehow vanish if SCM_BOOL_F == 0.

Unfortunately that's not true; it would even make things worse because
NULL would now be a valid Scheme value.

Instead what's really needed is a special pointer-to-reclaimed-object
value that can be distinguished from valid Scheme values since that
value ends up in the car or cdr of weak pairs in hash table buckets.  As
such, SCM_PACK (NULL) was a good choice until now.

SCM_UNDEFINED == 0 would work fine because SCM_UNDEFINED is not a valid
Scheme value, but it wouldn't change the implementation.

Thoughts?

Thanks,
Ludo'.

[0] 
http://git.savannah.gnu.org/cgit/guile.git/tree/libguile/weaks.c?h=boehm-demers-weiser-gc#n40
[1] 
http://git.savannah.gnu.org/cgit/guile.git/tree/libguile/hashtab.c?h=boehm-demers-weiser-gc#n97





reply via email to

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