aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2024-01-21 17:18:23 -0800
committerPaul Eggert2024-01-21 20:02:18 -0800
commitdf7c6211cb960b88bc0aaef85babf7e9384d5f2e (patch)
treee4de866b952553b40acda6c129101aed97fdc5f1 /src
parent7e490dd63979e2695605205f0bb4fa5131f8c2d9 (diff)
downloademacs-df7c6211cb960b88bc0aaef85babf7e9384d5f2e.tar.gz
emacs-df7c6211cb960b88bc0aaef85babf7e9384d5f2e.zip
Speed up builtin_lisp_symbol when not optimizing
This should help when building with --enable-checking and compiling with gcc -O0. Problem reorted by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2024-01/msg00770.html * src/lisp.h (lisp_h_builtin_lisp_symbol): New macro, with a body equivalent in effect to the old ‘builtin_lisp_symbol’ but faster when not optimizing. (builtin_lisp_symbol): Use it. If DEFINE_KEY_OPS_AS_MACROS, also define as macro.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lisp.h b/src/lisp.h
index ae78947805e..29d2a08785a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -409,6 +409,10 @@ typedef EMACS_INT Lisp_Word;
409 & ((1 << INTTYPEBITS) - 1))) 409 & ((1 << INTTYPEBITS) - 1)))
410#define lisp_h_FLOATP(x) TAGGEDP (x, Lisp_Float) 410#define lisp_h_FLOATP(x) TAGGEDP (x, Lisp_Float)
411#define lisp_h_NILP(x) BASE_EQ (x, Qnil) 411#define lisp_h_NILP(x) BASE_EQ (x, Qnil)
412/* Equivalent to "make_lisp_symbol (&lispsym[INDEX])",
413 and typically faster when compiling without optimization. */
414#define lisp_h_builtin_lisp_symbol(index) \
415 TAG_PTR (Lisp_Symbol, (index) * sizeof *lispsym)
412#define lisp_h_SET_SYMBOL_VAL(sym, v) \ 416#define lisp_h_SET_SYMBOL_VAL(sym, v) \
413 (eassert ((sym)->u.s.redirect == SYMBOL_PLAINVAL), \ 417 (eassert ((sym)->u.s.redirect == SYMBOL_PLAINVAL), \
414 (sym)->u.s.val.value = (v)) 418 (sym)->u.s.val.value = (v))
@@ -475,6 +479,7 @@ typedef EMACS_INT Lisp_Word;
475# define FLOATP(x) lisp_h_FLOATP (x) 479# define FLOATP(x) lisp_h_FLOATP (x)
476# define FIXNUMP(x) lisp_h_FIXNUMP (x) 480# define FIXNUMP(x) lisp_h_FIXNUMP (x)
477# define NILP(x) lisp_h_NILP (x) 481# define NILP(x) lisp_h_NILP (x)
482# define builtin_lisp_symbol(index) lisp_h_builtin_lisp_symbol (index)
478# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_VAL (sym, v) 483# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_VAL (sym, v)
479# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONSTANT_P (sym) 484# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONSTANT_P (sym)
480# define SYMBOL_TRAPPED_WRITE_P(sym) lisp_h_SYMBOL_TRAPPED_WRITE_P (sym) 485# define SYMBOL_TRAPPED_WRITE_P(sym) lisp_h_SYMBOL_TRAPPED_WRITE_P (sym)
@@ -1171,9 +1176,9 @@ make_lisp_symbol (struct Lisp_Symbol *sym)
1171} 1176}
1172 1177
1173INLINE Lisp_Object 1178INLINE Lisp_Object
1174builtin_lisp_symbol (int index) 1179(builtin_lisp_symbol) (int index)
1175{ 1180{
1176 return make_lisp_symbol (&lispsym[index]); 1181 return lisp_h_builtin_lisp_symbol (index);
1177} 1182}
1178 1183
1179INLINE bool 1184INLINE bool