From: Andrea Corallo Date: Wed, 17 Feb 2021 21:26:28 +0000 (+0100) Subject: Merge remote-tracking branch 'savannah/master' into native-comp X-Git-Tag: emacs-28.0.90~2727^2~145 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f92bb788a073c6b3ca7f188e0edea714598193fd;p=emacs.git Merge remote-tracking branch 'savannah/master' into native-comp --- f92bb788a073c6b3ca7f188e0edea714598193fd diff --cc lisp/emacs-lisp/byte-run.el index a3ad43038e7,76e7f01ace6..5de7bc6049a --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@@ -143,11 -146,18 +146,23 @@@ The return value of this function is no (list 'function-put (list 'quote f) ''lisp-indent-function (list 'quote val)))) +(defalias 'byte-run--set-speed + #'(lambda (f _args val) + (list 'function-put (list 'quote f) + ''speed (list 'quote val)))) + + (defalias 'byte-run--set-completion + #'(lambda (f _args val) + (list 'function-put (list 'quote f) + ''completion-predicate val))) + + (defalias 'byte-run--set-modes + #'(lambda (f _args &rest val) + (list 'function-put (list 'quote f) + ''completion-predicate + `(lambda (_ b) + (command-completion-with-modes-p ',val b))))) + ;; Add any new entries to info node `(elisp)Declare Form'. (defvar defun-declarations-alist (list @@@ -165,7 -175,8 +180,9 @@@ If `error-free', drop calls even if `by (list 'compiler-macro #'byte-run--set-compiler-macro) (list 'doc-string #'byte-run--set-doc-string) (list 'indent #'byte-run--set-indent) - (list 'speed #'byte-run--set-speed)) ++ (list 'speed #'byte-run--set-speed) + (list 'completion #'byte-run--set-completion) + (list 'modes #'byte-run--set-modes)) "List associating function properties to their macro expansion. Each element of the list takes the form (PROP FUN) where FUN is a function. For each (PROP . VALUES) in a function's declaration, diff --cc lisp/emacs-lisp/bytecomp.el index 709a310eb6c,9d80afd774f..0da7b83791e --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@@ -3069,30 -2991,30 +3072,37 @@@ for symbols generated by the byte compi reserved-csts))) ;; Build the actual byte-coded function. (cl-assert (eq 'byte-code (car-safe compiled))) - (apply #'make-byte-code - (if lexical-binding - (byte-compile-make-args-desc arglist) - arglist) - (append - ;; byte-string, constants-vector, stack depth - (cdr compiled) - ;; optionally, the doc string. - (cond ((and lexical-binding arglist) - ;; byte-compile-make-args-desc lost the args's names, - ;; so preserve them in the docstring. - (list (help-add-fundoc-usage doc arglist))) - ((or doc int) - (list doc))) - ;; optionally, the interactive spec (and the modes the - ;; command applies to). - (cond - ;; We have some command modes, so use the vector form. - (command-modes - (list (vector (nth 1 int) command-modes))) - ;; No command modes, use the simple form with just the - ;; interactive spec. - (int - (list (nth 1 int))))))))) + (let ((out - (apply #'make-byte-code - (if lexical-binding - (byte-compile-make-args-desc arglist) - arglist) - (append - ;; byte-string, constants-vector, stack depth - (cdr compiled) - ;; optionally, the doc string. - (cond ((and lexical-binding arglist) - ;; byte-compile-make-args-desc lost the args's names, - ;; so preserve them in the docstring. - (list (help-add-fundoc-usage doc arglist))) - ((or doc int) - (list doc))) - ;; optionally, the interactive spec. - (if int - (list (nth 1 int))))))) - (when byte-native-compiling ++ (apply #'make-byte-code ++ (if lexical-binding ++ (byte-compile-make-args-desc arglist) ++ arglist) ++ (append ++ ;; byte-string, constants-vector, stack depth ++ (cdr compiled) ++ ;; optionally, the doc string. ++ (cond ((and lexical-binding arglist) ++ ;; byte-compile-make-args-desc lost the args's names, ++ ;; so preserve them in the docstring. ++ (list (help-add-fundoc-usage doc arglist))) ++ ((or doc int) ++ (list doc))) ++ ;; optionally, the interactive spec (and the modes the ++ ;; command applies to). ++ (cond ++ ;; We have some command modes, so use the vector form. ++ (command-modes ++ (list (vector (nth 1 int) command-modes))) ++ ;; No command modes, use the simple form with just the ++ ;; interactive spec. ++ (int ++ (list (nth 1 int)))))))) ++ (when byte-native-compiling + (setf (byte-to-native-lambda-byte-func + (gethash (cadr compiled) + byte-to-native-lambdas-h)) + out)) - out)))) ++ out)))) (defvar byte-compile-reserved-constants 0)