aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPip Cet2024-12-11 22:31:07 +0000
committerAndrea Corallo2025-09-22 10:28:40 +0200
commit020e2f5ddbbc2f380f694e1537aaa8405daf5829 (patch)
treecb773d9142a1e9bd79baf03c5c2670cedc53bef3 /src
parente58efac78eed96842e4b6cbc64a1633e74edd6c1 (diff)
downloademacs-020e2f5ddbbc2f380f694e1537aaa8405daf5829.tar.gz
emacs-020e2f5ddbbc2f380f694e1537aaa8405daf5829.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.
Diffstat (limited to 'src')
-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