[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 9531271 2/8: * Add 'cl-optimize' as function declara
From: |
Andrea Corallo |
Subject: |
feature/native-comp 9531271 2/8: * Add 'cl-optimize' as function declaration |
Date: |
Mon, 14 Sep 2020 17:22:56 -0400 (EDT) |
branch: feature/native-comp
commit 95312717c726e390de26bd85341a17b163b40fd7
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Add 'cl-optimize' as function declaration
* lisp/emacs-lisp/cl-macs.el: Register cl-optimize into
`defun-declarations-alist' and `macro-declarations-alist'.
(cl--optimize): New function to serve 'cl-optimize' declaration.
---
lisp/emacs-lisp/cl-macs.el | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 7adb910..2730e8f 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2347,6 +2347,26 @@ values. For compatibility, (cl-values A B C) is a
synonym for (list A B C).
(list ',type ,temp ',form)))
,temp))))
+;;;###autoload
+(or (assq 'cl-optimize defun-declarations-alist)
+ (let ((x (list 'cl-optimize #'cl--optimize)))
+ (push x macro-declarations-alist)
+ (push x defun-declarations-alist)))
+
+(defun cl--optimize (f _args &rest qualities)
+ "Serve 'cl-optimize' in function declarations.
+Example:
+(defun foo (x)
+ (declare (cl-optimize (speed 3) (safety 0)))
+ x)"
+ (cl-loop for (qly val) in qualities
+ do (cl-ecase qly
+ (speed
+ (setf cl--optimize-speed val)
+ (byte-run--set-speed f nil val))
+ (safety
+ (setf cl--optimize-safety val)))))
+
(defvar cl--proclaim-history t) ; for future compilers
(defvar cl--declare-stack t) ; for future compilers
- feature/native-comp updated (21021e5 -> 5f37c18), Andrea Corallo, 2020/09/14
- feature/native-comp c4cc139 1/8: * lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native., Andrea Corallo, 2020/09/14
- feature/native-comp 9531271 2/8: * Add 'cl-optimize' as function declaration,
Andrea Corallo <=
- feature/native-comp 2da2ad2 5/8: * lisp/emacs-lisp/comp.el (comp-sp): Better style gv-setter declaration., Andrea Corallo, 2020/09/14
- feature/native-comp a3dc11e 4/8: * Remove type check emission from type hints low level primitives, Andrea Corallo, 2020/09/14
- feature/native-comp 82171a8 6/8: * Add gv-setters for compiler hints, Andrea Corallo, 2020/09/14
- feature/native-comp e972837 7/8: * Fix free function compilation load process., Andrea Corallo, 2020/09/14
- feature/native-comp c9a9b07 3/8: * lisp/emacs-lisp/cl-macs.el: Define fixnum and bignum., Andrea Corallo, 2020/09/14
- feature/native-comp 5f37c18 8/8: * test/src/comp-tests.el (comp-tests-bootstrap): Print compilation time., Andrea Corallo, 2020/09/14