diff options
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 25513bd0248..efe86404fcf 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -197,6 +197,7 @@ adds `c' to it; otherwise adds `.elc'." | |||
| 197 | ;; that doesn't define this function, so this seems to be a reasonable | 197 | ;; that doesn't define this function, so this seems to be a reasonable |
| 198 | ;; thing to do. | 198 | ;; thing to do. |
| 199 | (autoload 'byte-decompile-bytecode "byte-opt") | 199 | (autoload 'byte-decompile-bytecode "byte-opt") |
| 200 | (autoload 'byte-optimize-lapcode-tail-recursion "byte-opt") | ||
| 200 | 201 | ||
| 201 | (defcustom byte-compile-verbose | 202 | (defcustom byte-compile-verbose |
| 202 | (and (not noninteractive) (> baud-rate search-slow-speed)) | 203 | (and (not noninteractive) (> baud-rate search-slow-speed)) |
| @@ -1000,6 +1001,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." | |||
| 1000 | (defvar byte-compile-current-file nil) | 1001 | (defvar byte-compile-current-file nil) |
| 1001 | (defvar byte-compile-current-group nil) | 1002 | (defvar byte-compile-current-group nil) |
| 1002 | (defvar byte-compile-current-buffer nil) | 1003 | (defvar byte-compile-current-buffer nil) |
| 1004 | (defvar byte-compile-current-defun nil) | ||
| 1005 | (defvar byte-compile-current-arglist nil) | ||
| 1003 | 1006 | ||
| 1004 | ;; Log something that isn't a warning. | 1007 | ;; Log something that isn't a warning. |
| 1005 | (defmacro byte-compile-log (format-string &rest args) | 1008 | (defmacro byte-compile-log (format-string &rest args) |
| @@ -2538,7 +2541,9 @@ not to take responsibility for the actual compilation of the code." | |||
| 2538 | ;; Tell the caller that we didn't compile it yet. | 2541 | ;; Tell the caller that we didn't compile it yet. |
| 2539 | nil) | 2542 | nil) |
| 2540 | 2543 | ||
| 2541 | (let* ((code (byte-compile-lambda (cons arglist body) t))) | 2544 | (let* ((byte-compile-current-defun name) |
| 2545 | (byte-compile-current-arglist arglist) | ||
| 2546 | (code (byte-compile-lambda (cons arglist body) t))) | ||
| 2542 | (if this-one | 2547 | (if this-one |
| 2543 | ;; A definition in b-c-initial-m-e should always take precedence | 2548 | ;; A definition in b-c-initial-m-e should always take precedence |
| 2544 | ;; during compilation, so don't let it be redefined. (Bug#8647) | 2549 | ;; during compilation, so don't let it be redefined. (Bug#8647) |
| @@ -2668,11 +2673,13 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2668 | (setq fun (byte-compile--reify-function fun))) | 2673 | (setq fun (byte-compile--reify-function fun))) |
| 2669 | ;; Expand macros. | 2674 | ;; Expand macros. |
| 2670 | (setq fun (byte-compile-preprocess fun)) | 2675 | (setq fun (byte-compile-preprocess fun)) |
| 2671 | (setq fun (byte-compile-top-level fun nil 'eval)) | 2676 | (let ((byte-compile-current-defun (and (symbolp form) form)) |
| 2672 | (if macro (push 'macro fun)) | 2677 | (byte-compile-current-arglist (nth 1 (cadr fun)))) |
| 2673 | (if (symbolp form) | 2678 | (setq fun (byte-compile-top-level fun nil 'eval)) |
| 2674 | (fset form fun) | 2679 | (if macro (push 'macro fun)) |
| 2675 | fun))))))) | 2680 | (if (symbolp form) |
| 2681 | (fset form fun) | ||
| 2682 | fun)))))))) | ||
| 2676 | 2683 | ||
| 2677 | (defun byte-compile-sexp (sexp) | 2684 | (defun byte-compile-sexp (sexp) |
| 2678 | "Compile and return SEXP." | 2685 | "Compile and return SEXP." |
| @@ -2923,9 +2930,15 @@ for symbols generated by the byte compiler itself." | |||
| 2923 | (caar tmp)))))) | 2930 | (caar tmp)))))) |
| 2924 | (byte-compile-out 'byte-return 0) | 2931 | (byte-compile-out 'byte-return 0) |
| 2925 | (setq byte-compile-output (nreverse byte-compile-output)) | 2932 | (setq byte-compile-output (nreverse byte-compile-output)) |
| 2926 | (if (memq byte-optimize '(t byte)) | 2933 | (when (memq byte-optimize '(t byte)) |
| 2934 | (setq byte-compile-output | ||
| 2935 | (byte-optimize-lapcode byte-compile-output)) | ||
| 2936 | ;; Do tail recursion optimization after `byte-optimize-lapcode', | ||
| 2937 | ;; since the lapcode now contains more than a single `byte-return', | ||
| 2938 | ;; allowing us to optimize multiple tail recursive calls | ||
| 2939 | (when byte-compile-current-defun | ||
| 2927 | (setq byte-compile-output | 2940 | (setq byte-compile-output |
| 2928 | (byte-optimize-lapcode byte-compile-output))) | 2941 | (byte-optimize-lapcode-tail-recursion byte-compile-output)))) |
| 2929 | 2942 | ||
| 2930 | ;; Decompile trivial functions: | 2943 | ;; Decompile trivial functions: |
| 2931 | ;; only constants and variables, or a single funcall except in lambdas. | 2944 | ;; only constants and variables, or a single funcall except in lambdas. |