]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify and tune XSYMBOL
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 21 Jan 2024 00:52:31 +0000 (16:52 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 21 Jan 2024 07:31:23 +0000 (08:31 +0100)
* src/lisp.h (XSYMBOL): Simplify and tune.  There is no need to
examine symbols_with_pos_enabled here, since the arg must be a symbol
so if it's not a bare symbol then it must be a symbol_with_pos;
and checking whether a symbol is bare is cheap.

With Ubuntu 23.10 on a Xeon W-1350, this shrank Emacs’s executable
text size by 0.1% and sped up a default build of all *.elc files by
0.4%.

Remove unnecessary eassert, since XBARE_SYMBOL and XSYMBOL_WITH_POS
have easserts that suffice.

(cherry picked from commit cf26f573162130fed73c6e5603cb58e158903add)

src/lisp.h

index 20b28e93c8d778aef49b052531564876cf618cc3..c3309c81a1665fde09ebdde5daeb0fd9c1aa4450 100644 (file)
@@ -1156,10 +1156,7 @@ XBARE_SYMBOL (Lisp_Object a)
 INLINE struct Lisp_Symbol * ATTRIBUTE_NO_SANITIZE_UNDEFINED
 XSYMBOL (Lisp_Object a)
 {
-  eassert (SYMBOLP (a));
-  if (!symbols_with_pos_enabled || BARE_SYMBOL_P (a))
-    return XBARE_SYMBOL (a);
-  return XBARE_SYMBOL (XSYMBOL_WITH_POS (a)->sym);
+  return XBARE_SYMBOL (BARE_SYMBOL_P (a) ? a : XSYMBOL_WITH_POS (a)->sym);
 }
 
 INLINE Lisp_Object