emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp c4cc139 1/8: * lisp/emacs-lisp/cl-macs.el (cl-the):


From: Andrea Corallo
Subject: feature/native-comp c4cc139 1/8: * lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native.
Date: Mon, 14 Sep 2020 17:22:56 -0400 (EDT)

branch: feature/native-comp
commit c4cc13917cdf733b142ed2dee9b5aee9df9f8153
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native.
---
 lisp/emacs-lisp/cl-macs.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index c38019d..7adb910 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]