mit-scheme-devel
[Top][All Lists]
Advanced

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

[MIT-Scheme-devel] interning symbols weakly


From: Taylor R Campbell
Subject: [MIT-Scheme-devel] interning symbols weakly
Date: Sat, 21 Nov 2009 00:57:50 -0500
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

Attached is a patch[*] to intern symbols weakly, so that unused
symbols can be garbage-collected.  This sounds like it should be
trivial, but there is a complication because the `global' environment
is represented implicitly by an extra slot in each symbol for its
value in that environment.  To accomodate this, the patch strongly
interns symbols bound in the global environment: defining or
undefining a global variable strengthens or weakens its reference in
the symbol table, which may have the consequence of slightly slowing
down linking and interpreting definitions in the system global
environment.

I think I have covered all the cases in lookup.c requiring
strengthening or weakening symbols; Scheme stably runs a test
involving defining lots of symbols with randomly generated names in
the system global environment and then undefining them, although that
doesn't test everything.  A secondary GC daemon deletes broken entries
from the symbol table if space is short.

Comments (other than that the strengthening and weakening mechanism is
a crock)?  Worth committing?  I think garbage-collecting symbols is
the right thing -- the only question is whether this approach to
making them collectable is too hairy.

[*] Apply weaksym.patch with `patch -p1 < /path/to/weaksym.patch' from
    the top level of the Git repository.

Attachment: weaksym.patch
Description: Text document


reply via email to

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