aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPip Cet2024-12-11 22:31:07 +0000
committerAndrea Corallo2025-09-18 10:34:46 +0200
commit720e8b94c0eaa21317a25e3c0c960edd283cf341 (patch)
tree990e35a8b814d5975321f6b70fc50b7222c9a594
parentde4ca2bdb1ae69a6ad0c4fc0473f2823e74f7f2b (diff)
downloademacs-720e8b94c0eaa21317a25e3c0c960edd283cf341.tar.gz
emacs-720e8b94c0eaa21317a25e3c0c960edd283cf341.zip
Change EQ to move slow code path into a separate function
* src/data.c (slow_eq): New function. * src/lisp.h (EQ): Call it.
-rw-r--r--src/data.c10
-rw-r--r--src/lisp.h11
2 files changed, 17 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c
index 5b3c9792ea0..333d908aedc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -155,6 +155,16 @@ circular_list (Lisp_Object list)
155 155
156/* Data type predicates. */ 156/* Data type predicates. */
157 157
158/* NO_INLINE to avoid excessive code growth when LTO is in use. */
159NO_INLINE bool
160slow_eq (Lisp_Object x, Lisp_Object y)
161{
162 return BASE_EQ ((symbols_with_pos_enabled && SYMBOL_WITH_POS_P (x)
163 ? XSYMBOL_WITH_POS_SYM (x) : x),
164 (symbols_with_pos_enabled && SYMBOL_WITH_POS_P (y)
165 ? XSYMBOL_WITH_POS_SYM (y) : y));
166}
167
158DEFUN ("eq", Feq, Seq, 2, 2, 0, 168DEFUN ("eq", Feq, Seq, 2, 2, 0,
159 doc: /* Return t if the two args are the same Lisp object. */ 169 doc: /* Return t if the two args are the same Lisp object. */
160 attributes: const) 170 attributes: const)
diff --git a/src/lisp.h b/src/lisp.h
index 1782b12e7fd..88406aa0ce8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -634,6 +634,7 @@ extern AVOID wrong_type_argument (Lisp_Object, Lisp_Object);
634extern Lisp_Object default_value (Lisp_Object symbol); 634extern Lisp_Object default_value (Lisp_Object symbol);
635extern void defalias (Lisp_Object symbol, Lisp_Object definition); 635extern void defalias (Lisp_Object symbol, Lisp_Object definition);
636extern char *fixnum_to_string (EMACS_INT number, char *buffer, char *end); 636extern char *fixnum_to_string (EMACS_INT number, char *buffer, char *end);
637extern bool slow_eq (Lisp_Object x, Lisp_Object y);
637 638
638 639
639/* Defined in emacs.c. */ 640/* Defined in emacs.c. */
@@ -1325,10 +1326,12 @@ INLINE bool
1325INLINE bool 1326INLINE bool
1326EQ (Lisp_Object x, Lisp_Object y) 1327EQ (Lisp_Object x, Lisp_Object y)
1327{ 1328{
1328 return BASE_EQ ((__builtin_expect (symbols_with_pos_enabled, false) 1329 if (BASE_EQ (x, y))
1329 && SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS_SYM (x) : x), 1330 return true;
1330 (__builtin_expect (symbols_with_pos_enabled, false) 1331 else if (!symbols_with_pos_enabled)
1331 && SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS_SYM (y) : y)); 1332 return false;
1333 else
1334 return slow_eq (x, y);
1332} 1335}
1333 1336
1334INLINE intmax_t 1337INLINE intmax_t