aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/bytecomp.el56
1 files changed, 47 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 0052a947aa5..682771c97cb 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -10,7 +10,7 @@
10 10
11;;; This version incorporates changes up to version 2.10 of the 11;;; This version incorporates changes up to version 2.10 of the
12;;; Zawinski-Furuseth compiler. 12;;; Zawinski-Furuseth compiler.
13(defconst byte-compile-version "$Revision: 2.14 $") 13(defconst byte-compile-version "$Revision: 2.15 $")
14 14
15;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
16 16
@@ -1846,7 +1846,38 @@ If FORM is a lambda or a macro, byte-compile it as a function."
1846 ((atom fun) ; compiled function. 1846 ((atom fun) ; compiled function.
1847 ;; generate-emacs19-bytecodes must be on, otherwise byte-compile-lambda 1847 ;; generate-emacs19-bytecodes must be on, otherwise byte-compile-lambda
1848 ;; would have produced a lambda. 1848 ;; would have produced a lambda.
1849 fun) 1849 (let ((const-vector (aref fun 2))
1850 (i 0)
1851 (uninterned nil))
1852 ;; Find all the uninterned symbols that appear
1853 ;; as constants in this function.
1854 (while (< i (length const-vector))
1855 (and (symbolp (aref const-vector i))
1856 (not (eq (aref const-vector i)
1857 (intern-soft (symbol-name (aref const-vector i)))))
1858 (setq uninterned (cons i uninterned)))
1859 (setq i (1+ i)))
1860 ;; Arrange to regenrate the uninterned symbols
1861 ;; when we read in this code to produce the compiled function.
1862 (if uninterned
1863 (let (modifiers)
1864 (while uninterned
1865 (let ((symbol (aref const-vector (car uninterned)))
1866 fixup)
1867 (setq fixup
1868 ;; Some uninterned symbols specify how to
1869 ;; regenerate them.
1870 (if (get symbol 'byte-compile-regenerate)
1871 `(aset const-vector ,(car uninterned)
1872 ,(get symbol 'byte-compile-regenerate))
1873 `(aset const-vector ,(car uninterned)
1874 (make-symbol ',(symbol-name symbol)))))
1875 (setq modifiers (cons fixup modifiers)))
1876 (setq uninterned (cdr uninterned)))
1877 `(let* ((function ,fun) (const-vector (aref function 2)))
1878 ,@modifiers
1879 function))
1880 fun)))
1850 ;; b-c-lambda didn't produce a compiled-function, so it's either a trivial 1881 ;; b-c-lambda didn't produce a compiled-function, so it's either a trivial
1851 ;; function, or this is Emacs 18, or generate-emacs19-bytecodes is off. 1882 ;; function, or this is Emacs 18, or generate-emacs19-bytecodes is off.
1852 ((let (tmp) 1883 ((let (tmp)
@@ -2057,13 +2088,20 @@ If FORM is a lambda or a macro, byte-compile it as a function."
2057 (while (cond 2088 (while (cond
2058 ((memq (car (car rest)) '(byte-varref byte-constant)) 2089 ((memq (car (car rest)) '(byte-varref byte-constant))
2059 (setq tmp (car (cdr (car rest)))) 2090 (setq tmp (car (cdr (car rest))))
2060 (if (if (eq (car (car rest)) 'byte-constant) 2091 ;; If we find an uninterned symbol as a constant
2061 (or (consp tmp) 2092 ;; or variable, this expression must be compiled!
2062 (and (symbolp tmp) 2093 ;; That is because byte-compile-byte-code-maker
2063 (not (memq tmp '(nil t)))))) 2094 ;; must get a chance to process the uninterned symbol.
2064 (if maycall 2095 (if (and (symbolp tmp)
2065 (setq body (cons (list 'quote tmp) body))) 2096 (not (eq tmp (intern-soft (symbol-name tmp)))))
2066 (setq body (cons tmp body)))) 2097 nil
2098 (if (if (eq (car (car rest)) 'byte-constant)
2099 (or (consp tmp)
2100 (and (symbolp tmp)
2101 (not (memq tmp '(nil t))))))
2102 (if maycall
2103 (setq body (cons (list 'quote tmp) body)))
2104 (setq body (cons tmp body)))))
2067 ((and maycall 2105 ((and maycall
2068 ;; Allow a funcall if at most one atom follows it. 2106 ;; Allow a funcall if at most one atom follows it.
2069 (null (nthcdr 3 rest)) 2107 (null (nthcdr 3 rest))