summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-01-05 09:07:45 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-01-05 10:15:04 -0800
commitbc78ff2603b8c062dbd8f93f421c3412e36e343f (patch)
tree52f5ad17e9a61db8287ed4a026abfb4dc64ccd16 /lib-src
parent58f2d6ef32b28a787fcc4e0d98b3f331ceb2a68c (diff)
downloademacs-bc78ff2603b8c062dbd8f93f421c3412e36e343f.tar.gz
Use 0 for Qnil
Fixes Bug#15880. If USE_LSB_TAG, arrange for the representation of Qnil to be zero so that NILP (x) is equivalent to testing whether x is 0 at the machine level. The overall effects of this and the previous patch shrink the size of the text segment by 2.3% and speeds up compilation of all the .elc files by about 0.5% on my platform, which is Fedora 20 x86-64. * lib-src/make-docfile.c (compare_globals): * src/lisp.h (lisp_h_XPNTR, lisp_h_XSYMBOL, lisp_h_XUNTAG) (make_lisp_symbol) [USE_LSB_TAG]: Symbols now tag the difference from lispsym, not the pointer. (lisp_h_XUNTAGBASE, TAG_SYMPTR): New macros. (Lisp_Int0, Lisp_Int1, Lisp_Symbol, Lisp_Misc, Lisp_String, Lisp_Cons): Renumber so that Lisp_Symbol is 0, so that Qnil is zero. (XSYMBOL): New forward decl. (XUNTAGBASE): New function. (XUNTAG): Use it.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog3
-rw-r--r--lib-src/make-docfile.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 8bdf7d1fb16..9a1fc7a3e9f 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,5 +1,8 @@
2015-01-05 Paul Eggert <eggert@cs.ucla.edu>
+ Use 0 for Qnil
+ * make-docfile.c (compare_globals): Consider 'nil' to be the least.
+
Compute C decls for DEFSYMs automatically
Fixes Bug#15880.
* make-docfile.c: Revamp to generate table of symbols, too.
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index b05a634eb75..22c4bad2e3f 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -613,6 +613,16 @@ compare_globals (const void *a, const void *b)
if (ga->type != gb->type)
return ga->type - gb->type;
+ /* Consider "nil" to be the least, so that aQnil is firat. That
+ way, Qnil's internal representation is zero, which is a bit faster. */
+ if (ga->type == SYMBOL)
+ {
+ bool a_nil = strcmp (ga->name, "Qnil") == 0;
+ bool b_nil = strcmp (gb->name, "Qnil") == 0;
+ if (a_nil | b_nil)
+ return b_nil - a_nil;
+ }
+
return strcmp (ga->name, gb->name);
}