summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-09-01 22:51:32 +0200
committerAndrea Corallo <akrl@sdf.org>2020-09-01 22:51:32 +0200
commit612df640cbcc800c14768f0722e5cd7001faa5f0 (patch)
tree9dd94c5c546b54d56dc6f4b86a3b3197043e6d17
parentc3ddcf739f0406d4897bf6e1339f5514f36649b3 (diff)
downloademacs-scratch/native-comp-cl.tar.gz
Have cl-declare set function speed propscratch/native-comp-cl
-rw-r--r--lisp/emacs-lisp/byte-run.el4
-rw-r--r--lisp/emacs-lisp/cl-macs.el11
2 files changed, 11 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 8c16c172bed..8993a8169dd 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -258,6 +258,9 @@ The return value is undefined.
(cons 'prog1 (cons def declarations))
def))))))
+(defvar defun-last-function-name nil
+ "Last function name macroexpanded by `defun'.")
+
;; Now that we defined defmacro we can use it!
(defmacro defun (name arglist &optional docstring &rest body)
"Define NAME as a function.
@@ -280,6 +283,7 @@ The return value is undefined.
(and (listp arglist)
(null (delq t (mapcar #'symbolp arglist)))))
(error "Malformed arglist: %s" arglist))
+ (setq defun-last-function-name name)
(let ((decls (cond
((eq (car-safe docstring) 'declare)
(prog1 (cdr docstring) (setq docstring nil)))
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 75da0394067..235e7d0d75b 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2374,10 +2374,13 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
'((0 nil) (1 t) (2 t) (3 t))))
(safety (assq (nth 1 (assq 'safety (cdr spec)))
'((0 t) (1 t) (2 t) (3 nil)))))
- (if speed (setq cl--optimize-speed (car speed)
- byte-optimize (nth 1 speed)))
- (if safety (setq cl--optimize-safety (car safety)
- byte-compile-delete-errors (nth 1 safety)))))
+ (when speed
+ (setq cl--optimize-speed (car speed)
+ byte-optimize (nth 1 speed))
+ (function-put defun-last-function-name 'speed cl--optimize-speed))
+ (when safety
+ (setq cl--optimize-safety (car safety)
+ byte-compile-delete-errors (nth 1 safety)))))
((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
(while (setq spec (cdr spec))