Subject: bug#15880: Compute C declarations for DEFSYMs automatically.

From: Stefan Monnier <[email-masked]>
Date: Wed, 13 Nov 2013 21:29:09 -0500

> Hmm, well, I suppose you're right.  Still, the idea of removing the
> dependency on DEFSYM-related globals would preclude the potential
> optimization of putting these globals into a table at compile-time.

Actually, I'm not sure I understand what you're suggesting here as
a table, and what the optimization could be.  Are you thinking of
something like:

  struct Lisp_Symbol symbol_structs[N];
  const Lisp_Object symbol_vals[N]
    = {
      Lisp_Symbol + (EMACS_INT)(symbol_structs + 0),
      Lisp_Symbol + (EMACS_INT)(symbol_structs + 1),
      ...
    }
  #define Qfoo (symbol_vals[0])
  #define Qbar (symbol_vals[1])
  ...

but if so, would that really be faster?  I mean, can the C compiler
really presume that symbol_vals[0] won't be changed and constant-fold
its value at link-time?

> I suppose that part of the issue is that I don't add or remove
> DEFSYMs very often, so even aside from the precluded optimization
> I'm reluctant to complicate the build system just to save a few
> build-time cycles on these rare occasions.

You might be right (tho my computers tend to be slowish and make such
recompilation very noticeable).

>> such that make-docfile finds the "INTERN", infers the Lisp name from the
>> C name and writes a "syms.c" file which does little else but initialize
>> all those symbols.
> I was thinking of something even simpler: no macros at all.

Sounds good, indeed.

        Stefan