Running Eric Marsden's script (now available as
contrib/stale-symbols.lisp from sbcl's CVS) on a recent core gives a
staggering number of references to gensym-like symbols. I've tracked
them down, I think, to references from %simple-fun-arglist slots of
external-entry-points (XEPs) for functions.
Putting an (optimize (debug 0)) into just the CLAMBDA branch of
MAKE-XEP-LAMBDA-EXPRESSION reduced the resulting core size by 500kB.
However, it also reduced the debugability of the core quite a bit,
firstly because there's a bug in our handling of (DEBUG 0) situations:
(defun foo ()
(declare (optimize (debug 0)))
(foo) -> ERROR, then ERROR-IN-DEBUGGER:
debugger invoked on condition of type TYPE-ERROR:
The value :LAMBDA-LIST-UNAVAILABLE is not of type LIST.
and secondly because all of the frames available in the backtrace seem
to be :EXTERNAL (i.e. from the external-entry-point, not from the called
CMUCL appears not to have this problem; at least, comparing backtraces
from (+ T T) shows no [:EXTERNAL] frames for CMUCL, while all of them
are [:EXTERNAL] for SBCL. So anyway, even fixing the debugger problem
(above) does not help debugging erroneous code with (DEBUG 0) in the
XEP, because all of the frames in the backtrace give off useless
:LAMBDA-LIST-UNAVAILABLE argument information.
Another tack I tried was to make a pool of gensyms to pluck out for
argument lists; however, I ran into cold-init problems which looked
scary, so rather than continue down that track I thought I'd report my
investigations so far, in the vague hope that someone has a bright idea.
Ideally, what we might want to do is set just the %SIMPLE-FUN-ARGLIST of
XEPs, much as we (now, as of sbcl-0.7.8.25) do for macros; however, it
seems less than trivial to follow XEPs around so that this adjustment
can be done.
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)