1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-10 05:30:45 -08:00

Change EQ to move slow code path into a separate function

* src/data.c (slow_eq): New function.
    * src/lisp.h (EQ): Call it.
This commit is contained in:
Pip Cet 2024-12-11 22:31:07 +00:00 committed by Andrea Corallo
parent e58efac78e
commit 020e2f5ddb
2 changed files with 17 additions and 4 deletions

View file

@ -155,6 +155,16 @@ circular_list (Lisp_Object list)
/* Data type predicates. */
/* NO_INLINE to avoid excessive code growth when LTO is in use. */
NO_INLINE bool
slow_eq (Lisp_Object x, Lisp_Object y)
{
return BASE_EQ ((symbols_with_pos_enabled && SYMBOL_WITH_POS_P (x)
? XSYMBOL_WITH_POS_SYM (x) : x),
(symbols_with_pos_enabled && SYMBOL_WITH_POS_P (y)
? XSYMBOL_WITH_POS_SYM (y) : y));
}
DEFUN ("eq", Feq, Seq, 2, 2, 0,
doc: /* Return t if the two args are the same Lisp object. */
attributes: const)

View file

@ -634,6 +634,7 @@ extern AVOID wrong_type_argument (Lisp_Object, Lisp_Object);
extern Lisp_Object default_value (Lisp_Object symbol);
extern void defalias (Lisp_Object symbol, Lisp_Object definition);
extern char *fixnum_to_string (EMACS_INT number, char *buffer, char *end);
extern bool slow_eq (Lisp_Object x, Lisp_Object y);
/* Defined in emacs.c. */
@ -1325,10 +1326,12 @@ INLINE bool
INLINE bool
EQ (Lisp_Object x, Lisp_Object y)
{
return BASE_EQ ((__builtin_expect (symbols_with_pos_enabled, false)
&& SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS_SYM (x) : x),
(__builtin_expect (symbols_with_pos_enabled, false)
&& SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS_SYM (y) : y));
if (BASE_EQ (x, y))
return true;
else if (!symbols_with_pos_enabled)
return false;
else
return slow_eq (x, y);
}
INLINE intmax_t