diff options
| author | Pip Cet | 2024-12-11 22:31:07 +0000 |
|---|---|---|
| committer | Andrea Corallo | 2025-09-18 10:34:46 +0200 |
| commit | 720e8b94c0eaa21317a25e3c0c960edd283cf341 (patch) | |
| tree | 990e35a8b814d5975321f6b70fc50b7222c9a594 | |
| parent | de4ca2bdb1ae69a6ad0c4fc0473f2823e74f7f2b (diff) | |
| download | emacs-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.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 11 |
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. */ | ||
| 159 | NO_INLINE bool | ||
| 160 | slow_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 | |||
| 158 | DEFUN ("eq", Feq, Seq, 2, 2, 0, | 168 | DEFUN ("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); | |||
| 634 | extern Lisp_Object default_value (Lisp_Object symbol); | 634 | extern Lisp_Object default_value (Lisp_Object symbol); |
| 635 | extern void defalias (Lisp_Object symbol, Lisp_Object definition); | 635 | extern void defalias (Lisp_Object symbol, Lisp_Object definition); |
| 636 | extern char *fixnum_to_string (EMACS_INT number, char *buffer, char *end); | 636 | extern char *fixnum_to_string (EMACS_INT number, char *buffer, char *end); |
| 637 | extern 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 | |||
| 1325 | INLINE bool | 1326 | INLINE bool |
| 1326 | EQ (Lisp_Object x, Lisp_Object y) | 1327 | EQ (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 | ||
| 1334 | INLINE intmax_t | 1337 | INLINE intmax_t |