]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/byte-opt.el
Require bytecomp for byte-goto-ops.
[gnu-emacs] / lisp / emacs-lisp / byte-opt.el
index cbfc5c7d800d3a5d99beff327b41f982e727f0cb..77997f4894aa189f5c631b3dde8dadaa43a1002c 100644 (file)
 
 ;;; Commentary:
 
-;;; This file has been censored by the Communications Decency Act.
-;;; That law was passed under the guise of a ban on pornography, but
-;;; it bans far more than that.  This file did not contain pornography,
-;;; but it was censored nonetheless.
-
-;;; For information on US government censorship of the Internet, and
-;;; what you can do to bring back freedom of the press, see the web
-;;; site http://www.vtw.org/
-
 ;; ========================================================================
 ;; "No matter how hard you try, you can't make a racehorse out of a pig.
 ;; You can, however, make a faster pig."
 
 ;;; Code:
 
+(require 'bytecomp)
+
 (defun byte-compile-log-lap-1 (format &rest args)
   (if (aref byte-code-vector 0)
       (error "The old version of the disassembler is loaded.  Reload new-bytecomp as well."))
              (cons (list 'lambda (aref fn 0)
                          (list 'byte-code string (aref fn 2) (aref fn 3)))
                    (cdr form)))
-         (if (not (eq (car fn) 'lambda)) (error "%s is not a lambda" name))
-         (cons fn (cdr form)))))))
+         (if (eq (car-safe fn) 'lambda)
+             (cons fn (cdr form))
+           ;; Give up on inlining.
+           form))))))
 
 ;;; ((lambda ...) ...)
 ;;; 
 
          ;; Support compiler macros as in cl.el.
          ((and (fboundp 'compiler-macroexpand)
+               (symbolp (car-safe form))
+               (get (car-safe form) 'cl-compiler-macro)
                (not (eq form
-                        (setq form (compiler-macroexpand form
-                                    byte-compile-macro-environment)))))
+                        (setq form (compiler-macroexpand form)))))
           (byte-optimize-form form for-effect))
          
          ((not (symbolp fn))
                                             tags)))))))
            ((cond ((eq op 'byte-constant2) (setq op 'byte-constant) t)
                   ((memq op byte-constref-ops)))
-            (setq tmp (aref constvec offset)
+            (setq tmp (if (>= offset (length constvec))
+                          (list 'out-of-range offset)
+                        (aref constvec offset))
                   offset (if (eq op 'byte-constant)
                              (byte-compile-get-constant tmp)
                            (or (assq tmp byte-compile-variables)
 (defconst byte-after-unbind-ops
    '(byte-constant byte-dup
      byte-symbolp byte-consp byte-stringp byte-listp byte-numberp byte-integerp
-     byte-eq byte-equal byte-not
+     byte-eq byte-not
      byte-cons byte-list1 byte-list2   ; byte-list3 byte-list4
      byte-interactive-p)
    ;; How about other side-effect-free-ops?  Is it safe to move an
    ;; error invocation (such as from nth) out of an unwind-protect?
+   ;; No, it is not, because the unwind-protect forms can alter
+   ;; the inside of the object to which nth would apply.
+   ;; For the same reason, byte-equal was deleted from this list.
    "Byte-codes that can be moved past an unbind.")
 
 (defconst byte-compile-side-effect-and-error-free-ops
 ;;; the BOOL variables are, and not perform this optimization on them.
 ;;;
 (defconst byte-boolean-vars
-  '(abbrev-all-caps abbrevs-changed byte-metering-on
-    cannot-suspend completion-auto-help completion-ignore-case
-    cursor-in-echo-area debug-on-next-call debug-on-quit
-    delete-exited-processes enable-recursive-minibuffers
-    highlight-nonselected-windows indent-tabs-mode inhibit-local-menu-bar-menus
-    insert-default-directory inverse-video load-force-doc-strings
-    load-in-progress menu-prompting minibuffer-auto-raise
-    mode-line-inverse-video multiple-frames no-redraw-on-reenter noninteractive
-    parse-sexp-ignore-comments pop-up-frames pop-up-windows
-    print-escape-newlines system-uses-terminfo truncate-partial-width-windows
+  '(abbrev-all-caps abbrevs-changed byte-debug-flag byte-metering-on
+    cannot-suspend check-markers-debug-flag completion-auto-help
+    completion-ignore-case cursor-in-echo-area debug-on-next-call
+    debug-on-quit delete-exited-processes enable-recursive-minibuffers
+    garbage-collection-messages highlight-nonselected-windows
+    indent-tabs-mode inherit-process-coding-system inhibit-eol-conversion
+    inhibit-local-menu-bar-menus insert-default-directory inverse-video
+    keyword-symbols-constant-flag load-convert-to-unibyte
+    load-force-doc-strings load-in-progress menu-prompting
+    minibuffer-allow-text-properties minibuffer-auto-raise
+    mode-line-inverse-video multiple-frames no-redraw-on-reenter
+    noninteractive parse-sexp-ignore-comments parse-sexp-lookup-properties
+    pop-up-frames pop-up-windows print-escape-multibyte
+    print-escape-newlines
+    print-escape-nonascii print-quoted scroll-preserve-screen-position
+    system-uses-terminfo truncate-partial-width-windows use-dialog-box
     visible-bell vms-stmlf-recfm words-include-escapes)
   "DEFVAR_BOOL variables.  Giving these any non-nil value sets them to t.
 If this does not enumerate all DEFVAR_BOOL variables, the byte-optimizer