summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-09-01 21:28:22 +0200
committerAndrea Corallo <akrl@sdf.org>2020-09-14 23:06:42 +0200
commitc4cc13917cdf733b142ed2dee9b5aee9df9f8153 (patch)
tree49eeb62294aef9b2798b84def2776d9ecb5a07c1 /lisp/emacs-lisp
parent21021e56ad609a459ec117bcfc60b2802176a9a7 (diff)
downloademacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.tar.gz
emacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.tar.bz2
emacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.zip
* lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-macs.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index c38019d4a73..7adb9100703 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2329,6 +2329,14 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
(defmacro cl-the (type form)
"Return FORM. If type-checking is enabled, assert that it is of TYPE."
(declare (indent 1) (debug (cl-type-spec form)))
+ ;; When native compiling possibly add the appropriate type hint.
+ (when (and (boundp 'byte-native-compiling)
+ byte-native-compiling)
+ (setf form
+ (cl-case type
+ (fixnum `(comp-hint-fixnum ,form))
+ (cons `(comp-hint-cons ,form))
+ (otherwise form))))
(if (not (or (not (cl--compiling-file))
(< cl--optimize-speed 3)
(= cl--optimize-safety 3)))