Subject: Re: bug#17168: 24.3.50; Segfault at mark_object

From: Stefan Monnier <[email-masked]>
Date: Sun, 06 Apr 2014 15:58:27 -0400

> The pinned bit approach is exactly what I implemented, except that we
> walk obarray, like we already do, instead of all symbols.

We already walk obarray during the mark phase, so I don't understand
what you mean here.

> Your approach would require that we check for non-symbols in purecopy
> and reject them,

Yes.

> and it'd have a bigger performance impact, since we'd
> then need to walk the entire symbol list essentially twice.

Indeed.  I don't expect it to be significant, tho.  As you point out we
already walk that list once during gc_sweep, so doing it one more time
should be very quick.  Also, I'd expect that a significant proportion of
all symbols would be marked with that bit, so scanning all symbols won't
take that much longer than the alternative of only scanning a vector of
pinned symbols.  Also scanning all symbols like gc_sweep means that the
scan is nicely sequential in memory.

> I'd strongly prefer the fully general approach in my patch. It isn't
> *that* complicated.

But it requires more memory, whereas we already have space for an extra
bit in the Lisp_Symbol struct.  I guess the main difference resides in
whether we want to allow uninterning pinned symbols.  If we do as you
suggest and disallow it, then indeed, I expect there to be rather few
uninterned pinned symbols so using a small auxiliary array makes sense.
But I'd rather we don't pay attention to a symbol's interned status, so
we can later unintern them.

        Stefan