comparison lisp/bytecomp.el @ 5503:7b5946dbfb96

Drop support for generating code appropriate for Emacs 19, bytecomp.el lisp/ChangeLog addition: 2011-05-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: * bytecomp.el (byte-compile-two-args-19->20): Removed. * bytecomp.el (byte-compile-emacs19-compatibility): Removed. * bytecomp.el (byte-defop-compiler20): Removed. * bytecomp.el (byte-defop-compiler-rmsfun): Removed. * bytecomp.el (emacs-lisp-file-regexp): * bytecomp.el (byte-compile-print-gensym): * bytecomp.el (byte-compiler-legal-options): * bytecomp.el (byte-compiler-obsolete-options): * bytecomp.el (byte-compile-close-variables): * bytecomp.el (byte-compile-insert-header): * bytecomp.el (byte-compile-output-file-form): * bytecomp.el (byte-compile-output-docform): * bytecomp.el (byte-compile-out-toplevel): * bytecomp.el (byte-compile-form): * bytecomp.el (byte-defop-compiler-1): * bytecomp.el (eq): * bytecomp.el (equal): * bytecomp.el (member): * bytecomp.el (byte-compile-noop): * bytecomp.el (byte-compile-save-current-buffer): Remove support for generating code appropriate to Emacs 19. * bytecomp.el (byte-compile-eval): Avoid erroring here if the car of some entry in the macro environment is not a symbol, as is the case for symbol macros. * bytecomp.el (or): Use slightly better style when compiling the most important functions if bytecomp.el has just been loaded interpreted.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 07 May 2011 12:26:39 +0100
parents 248176c74e6b
children b0d87f92e60b
comparison
equal deleted inserted replaced
5502:5b08be74bb53 5503:7b5946dbfb96
119 ;;; mapc, and similar) 119 ;;; mapc, and similar)
120 ;;; 'quoted-lambda (quoting a lambda expression 120 ;;; 'quoted-lambda (quoting a lambda expression
121 ;;; as data, not as a function, 121 ;;; as data, not as a function,
122 ;;; and using it in a function 122 ;;; and using it in a function
123 ;;; context ) 123 ;;; context )
124 ;;; byte-compile-emacs19-compatibility Whether the compiler should
125 ;;; generate .elc files which can be loaded into
126 ;;; generic emacs 19.
127 ;;; emacs-lisp-file-regexp Regexp for the extension of source-files; 124 ;;; emacs-lisp-file-regexp Regexp for the extension of source-files;
128 ;;; see also the function `byte-compile-dest-file'. 125 ;;; see also the function `byte-compile-dest-file'.
129 ;;; byte-compile-overwrite-file If nil, delete old .elc files before saving. 126 ;;; byte-compile-overwrite-file If nil, delete old .elc files before saving.
130 ;;; 127 ;;;
131 ;;; Most of the above parameters can also be set on a file-by-file basis; see 128 ;;; Most of the above parameters can also be set on a file-by-file basis; see
216 213
217 (or (fboundp 'defsubst) 214 (or (fboundp 'defsubst)
218 ;; This really ought to be loaded already! 215 ;; This really ought to be loaded already!
219 (load-library "bytecomp-runtime")) 216 (load-library "bytecomp-runtime"))
220 217
221 (eval-when-compile
222 (defvar byte-compile-single-version t
223 "If this is true, the choice of emacs version (v19 or v20) byte-codes will
224 be hard-coded into bytecomp when it compiles itself. If the compiler itself
225 is compiled with optimization, this causes a speedup.")
226
227 (cond
228 (byte-compile-single-version
229 (defmacro byte-compile-single-version () t)
230 (defmacro byte-compile-version-cond (cond) (list 'quote (eval cond))))
231 (t
232 (defmacro byte-compile-single-version () nil)
233 (defmacro byte-compile-version-cond (cond) cond)))
234 )
235
236 (defvar emacs-lisp-file-regexp "\\.el$" 218 (defvar emacs-lisp-file-regexp "\\.el$"
237 "*Regexp which matches Emacs Lisp source files. 219 "*Regexp which matches Emacs Lisp source files.
238 You may want to redefine `byte-compile-dest-file' if you change this.") 220 You may want to redefine `byte-compile-dest-file' if you change this.")
239 221
240 ;; This enables file name handlers such as jka-compr 222 ;; This enables file name handlers such as jka-compr
275 257
276 (defvar byte-compile-verbose 258 (defvar byte-compile-verbose
277 (and (not noninteractive) (> (device-baud-rate) search-slow-speed)) 259 (and (not noninteractive) (> (device-baud-rate) search-slow-speed))
278 "*Non-nil means print messages describing progress of byte-compiler.") 260 "*Non-nil means print messages describing progress of byte-compiler.")
279 261
280 (defvar byte-compile-emacs19-compatibility
281 (not (emacs-version>= 20))
282 "*Non-nil means generate output that can run in Emacs 19.")
283
284 (defvar byte-compile-print-gensym t 262 (defvar byte-compile-print-gensym t
285 "*Non-nil means generate code that creates unique symbols at run-time. 263 "*Non-nil means generate code that creates unique symbols at run-time.
286 This is achieved by printing uninterned symbols using the `#:SYMBOL' 264 This is achieved by printing uninterned symbols using the `#:SYMBOL'
287 notation, so that they will be read uninterned when run. 265 notation, so that they will be read uninterned when run.
288 266
289 With this feature, code that uses uninterned symbols in macros will 267 With this feature, code that uses uninterned symbols in macros will
290 not be runnable under pre-21.0 XEmacsen. 268 not be runnable under pre-21.0 XEmacsen.")
291
292 When `byte-compile-emacs19-compatibility' is non-nil, this variable is
293 ignored and considered to be nil.")
294 269
295 (defvar byte-optimize t 270 (defvar byte-optimize t
296 "*Enables optimization in the byte compiler. 271 "*Enables optimization in the byte compiler.
297 nil means don't do any optimization. 272 nil means don't do any optimization.
298 t means do all optimizations. 273 t means do all optimizations.
480 ;;; "If a file being compiled contains a `defmacro' form, the macro is 455 ;;; "If a file being compiled contains a `defmacro' form, the macro is
481 ;;; defined temporarily for the rest of the compilation of that file." 456 ;;; defined temporarily for the rest of the compilation of that file."
482 (defun byte-compile-eval (form) 457 (defun byte-compile-eval (form)
483 (let ((save-macro-environment nil)) 458 (let ((save-macro-environment nil))
484 (unwind-protect 459 (unwind-protect
485 (loop for (sym . def) in byte-compile-macro-environment do 460 (loop
486 (push 461 for (sym . def) in byte-compile-macro-environment
487 (if (fboundp sym) (cons sym (symbol-function sym)) sym) 462 do (when (symbolp sym)
488 save-macro-environment) 463 (push
489 (fset sym (cons 'macro def)) 464 (if (fboundp sym)
465 (cons sym (symbol-function sym))
466 sym)
467 save-macro-environment)
468 (fset sym (cons 'macro def)))
490 finally return (eval form)) 469 finally return (eval form))
491 (dolist (elt save-macro-environment) 470 (dolist (elt save-macro-environment)
492 (if (symbolp elt) 471 (if (symbolp elt)
493 (fmakunbound elt) 472 (fmakunbound elt)
494 (fset (car elt) (cdr elt))))))) 473 (fset (car elt) (cdr elt)))))))
1091 1070
1092 ;; Compiler options 1071 ;; Compiler options
1093 1072
1094 (defconst byte-compiler-legal-options 1073 (defconst byte-compiler-legal-options
1095 '((optimize byte-optimize (t nil source byte) val) 1074 '((optimize byte-optimize (t nil source byte) val)
1096 (file-format byte-compile-emacs19-compatibility (emacs19 emacs20) 1075 (file-format byte-compile-emacs19-compatibility (emacs20)
1097 (eq val 'emacs19)) 1076 (eq val 'emacs19))
1098 (delete-errors byte-compile-delete-errors (t nil) val) 1077 (delete-errors byte-compile-delete-errors (t nil) val)
1099 (verbose byte-compile-verbose (t nil) val) 1078 (verbose byte-compile-verbose (t nil) val)
1100 (new-bytecodes byte-compile-new-bytecodes (t nil) val) 1079 (new-bytecodes byte-compile-new-bytecodes (t nil) val)
1101 (warnings byte-compile-warnings 1080 (warnings byte-compile-warnings
1103 unresolved discarded-consing quoted-lambda)) 1082 unresolved discarded-consing quoted-lambda))
1104 val))) 1083 val)))
1105 1084
1106 ;; XEmacs addition 1085 ;; XEmacs addition
1107 (defconst byte-compiler-obsolete-options 1086 (defconst byte-compiler-obsolete-options
1108 '((new-bytecodes t))) 1087 '((new-bytecodes t) (byte-compile-emacs19-compatibility nil)))
1109
1110 ;; Inhibit v19/v20 selectors if the version is hardcoded.
1111 ;; #### This should print a warning if the user tries to change something
1112 ;; than can't be changed because the running compiler doesn't support it.
1113 (cond
1114 ((byte-compile-single-version)
1115 (setcar (cdr (cdr (assq 'file-format byte-compiler-legal-options)))
1116 (if (byte-compile-version-cond byte-compile-emacs19-compatibility)
1117 '(emacs19) '(emacs20)))))
1118
1119 ;; now we can copy it.
1120 (setq byte-compiler-legal-options byte-compiler-legal-options)
1121 1088
1122 (defun byte-compiler-options-handler (&rest args) 1089 (defun byte-compiler-options-handler (&rest args)
1123 (let (key val desc choices) 1090 (let (key val desc choices)
1124 (while args 1091 (while args
1125 (if (or (atom (car args)) (nthcdr 2 (car args)) (null (cdr (car args)))) 1092 (if (or (atom (car args)) (nthcdr 2 (car args)) (null (cdr (car args))))
1420 ;; Close over these variables so that `byte-compiler-options' 1387 ;; Close over these variables so that `byte-compiler-options'
1421 ;; can change them on a per-file basis. 1388 ;; can change them on a per-file basis.
1422 ;; 1389 ;;
1423 (byte-compile-verbose byte-compile-verbose) 1390 (byte-compile-verbose byte-compile-verbose)
1424 (byte-optimize byte-optimize) 1391 (byte-optimize byte-optimize)
1425 (byte-compile-emacs19-compatibility
1426 byte-compile-emacs19-compatibility)
1427 (byte-compile-checks-on-load 1392 (byte-compile-checks-on-load
1428 byte-compile-checks-on-load) 1393 byte-compile-checks-on-load)
1429 (byte-compile-dynamic byte-compile-dynamic) 1394 (byte-compile-dynamic byte-compile-dynamic)
1430 (byte-compile-dynamic-docstrings 1395 (byte-compile-dynamic-docstrings
1431 byte-compile-dynamic-docstrings) 1396 byte-compile-dynamic-docstrings)
1858 ;; 0 string ;ELC XEmacs Lisp compiled file, 1823 ;; 0 string ;ELC XEmacs Lisp compiled file,
1859 ;; >4 byte x version %d 1824 ;; >4 byte x version %d
1860 ;; 1825 ;;
1861 (insert 1826 (insert
1862 ";ELC" 1827 ";ELC"
1863 (if (byte-compile-version-cond byte-compile-emacs19-compatibility) 19 20) 1828 20
1864 "\000\000\000\n") 1829 "\000\000\000\n")
1865 (when (not (eq (find-coding-system 'raw-text-unix) 1830 (when (not (eq (find-coding-system 'raw-text-unix)
1866 (find-coding-system buffer-file-coding-system))) 1831 (find-coding-system buffer-file-coding-system)))
1867 (insert (format ";;;###coding system: %s\n" 1832 (insert (format ";;;###coding system: %s\n"
1868 (coding-system-name buffer-file-coding-system)))) 1833 (coding-system-name buffer-file-coding-system))))
1972 '(autoload custom-declare-variable))) 1937 '(autoload custom-declare-variable)))
1973 (let ((print-escape-newlines t) 1938 (let ((print-escape-newlines t)
1974 (print-length nil) 1939 (print-length nil)
1975 (print-level nil) 1940 (print-level nil)
1976 (print-readably t) ; print #[] for bytecode, 'x for (quote x) 1941 (print-readably t) ; print #[] for bytecode, 'x for (quote x)
1977 (print-gensym (if (and byte-compile-print-gensym 1942 (print-gensym (if byte-compile-print-gensym '(t) nil))
1978 (not byte-compile-emacs19-compatibility))
1979 '(t) nil))
1980 print-gensym-alist) 1943 print-gensym-alist)
1981 (when byte-compile-output-preface 1944 (when byte-compile-output-preface
1982 (princ "\n(progn " byte-compile-outbuffer) 1945 (princ "\n(progn " byte-compile-outbuffer)
1983 (prin1 byte-compile-output-preface byte-compile-outbuffer)) 1946 (prin1 byte-compile-output-preface byte-compile-outbuffer))
1984 (princ "\n" byte-compile-outbuffer) 1947 (princ "\n" byte-compile-outbuffer)
2024 (let ((print-escape-newlines t) 1987 (let ((print-escape-newlines t)
2025 (print-readably t) ; print #[] for bytecode, 'x for (quote x) 1988 (print-readably t) ; print #[] for bytecode, 'x for (quote x)
2026 ;; Use a cons cell to say that we want 1989 ;; Use a cons cell to say that we want
2027 ;; print-gensym-alist not to be cleared between calls 1990 ;; print-gensym-alist not to be cleared between calls
2028 ;; to print functions. 1991 ;; to print functions.
2029 (print-gensym (if (and byte-compile-print-gensym 1992 (print-gensym (if byte-compile-print-gensym '(t) nil))
2030 (not byte-compile-emacs19-compatibility))
2031 '(t) nil))
2032 print-gensym-alist 1993 print-gensym-alist
2033 (index 0)) 1994 (index 0))
2034 (when byte-compile-output-preface 1995 (when byte-compile-output-preface
2035 (princ "\n(progn " byte-compile-outbuffer) 1996 (princ "\n(progn " byte-compile-outbuffer)
2036 (prin1 byte-compile-output-preface byte-compile-outbuffer)) 1997 (prin1 byte-compile-output-preface byte-compile-outbuffer))
2761 (setq body (cons (list 'quote tmp) body))) 2722 (setq body (cons (list 'quote tmp) body)))
2762 (setq body (cons tmp body)))) 2723 (setq body (cons tmp body))))
2763 ((and maycall 2724 ((and maycall
2764 ;; Allow a funcall if at most one atom follows it. 2725 ;; Allow a funcall if at most one atom follows it.
2765 (null (nthcdr 3 rest)) 2726 (null (nthcdr 3 rest))
2766 (setq tmp 2727 (setq tmp (get (car (car rest)) 'byte-opcode-invert))
2767 ;; XEmacs change for rms funs
2768 (or (and
2769 (byte-compile-version-cond
2770 byte-compile-emacs19-compatibility)
2771 (get (car (car rest))
2772 'byte-opcode19-invert))
2773 (get (car (car rest))
2774 'byte-opcode-invert)))
2775 (or (null (cdr rest)) 2728 (or (null (cdr rest))
2776 (and (memq output-type '(file progn t)) 2729 (and (memq output-type '(file progn t))
2777 (cdr (cdr rest)) 2730 (cdr (cdr rest))
2778 (eq (car (nth 1 rest)) 'byte-discard) 2731 (eq (car (nth 1 rest)) 'byte-discard)
2779 (progn (setq rest (cdr rest)) t)))) 2732 (progn (setq rest (cdr rest)) t))))
2826 ((symbolp (car form)) 2779 ((symbolp (car form))
2827 (let* ((fn (car form)) 2780 (let* ((fn (car form))
2828 (handler (get fn 'byte-compile))) 2781 (handler (get fn 'byte-compile)))
2829 (if (memq fn '(t nil)) 2782 (if (memq fn '(t nil))
2830 (byte-compile-warn "%s called as a function" fn)) 2783 (byte-compile-warn "%s called as a function" fn))
2831 (if (and handler 2784 (if handler
2832 (or (not (byte-compile-version-cond
2833 byte-compile-emacs19-compatibility))
2834 (not (get (get fn 'byte-opcode) 'emacs20-opcode))))
2835 (funcall handler form) 2785 (funcall handler form)
2836 (if (memq 'callargs byte-compile-warnings) 2786 (if (memq 'callargs byte-compile-warnings)
2837 (byte-compile-callargs-warn form)) 2787 (byte-compile-callargs-warn form))
2838 (byte-compile-normal-call form)))) 2788 (byte-compile-normal-call form))))
2839 ((and (or (compiled-function-p (car form)) 2789 ((and (or (compiled-function-p (car form))
3055 ''byte-opcode (list 'quote opcode)) 3005 ''byte-opcode (list 'quote opcode))
3056 (list 'put (list 'quote opcode) 3006 (list 'put (list 'quote opcode)
3057 ''byte-opcode-invert (list 'quote function))) 3007 ''byte-opcode-invert (list 'quote function)))
3058 fnform)))) 3008 fnform))))
3059 3009
3060 (defmacro byte-defop-compiler20 (function &optional compile-handler)
3061 ;; Just like byte-defop-compiler, but defines an opcode that will only
3062 ;; be used when byte-compile-emacs19-compatibility is false.
3063 (if (and (byte-compile-single-version)
3064 byte-compile-emacs19-compatibility)
3065 ;; #### instead of doing nothing, this should do some remprops,
3066 ;; #### to protect against the case where a single-version compiler
3067 ;; #### is loaded into a world that has contained a multi-version one.
3068 nil
3069 (list 'progn
3070 (list 'put
3071 (list 'quote
3072 (or (car (cdr-safe function))
3073 (intern (concat "byte-"
3074 (symbol-name (or (car-safe function) function))))))
3075 ''emacs20-opcode t)
3076 (list 'byte-defop-compiler function compile-handler))))
3077
3078 ;; XEmacs addition:
3079 (defmacro byte-defop-compiler-rmsfun (function &optional compile-handler)
3080 ;; for functions like `eq' that compile into different opcodes depending
3081 ;; on the Emacs version: byte-old-eq for v19, byte-eq for v20.
3082 (let ((opcode (intern (concat "byte-" (symbol-name function))))
3083 (opcode19 (intern (concat "byte-old-" (symbol-name function))))
3084 (fnform
3085 (list 'put (list 'quote function) ''byte-compile
3086 (list 'quote
3087 (or (cdr (assq compile-handler
3088 '((2 . byte-compile-two-args-19->20)
3089 )))
3090 compile-handler
3091 (intern (concat "byte-compile-"
3092 (symbol-name function))))))))
3093 (list 'progn fnform
3094 (list 'put (list 'quote function)
3095 ''byte-opcode (list 'quote opcode))
3096 (list 'put (list 'quote function)
3097 ''byte-opcode19 (list 'quote opcode19))
3098 (list 'put (list 'quote opcode)
3099 ''byte-opcode-invert (list 'quote function))
3100 (list 'put (list 'quote opcode19)
3101 ''byte-opcode19-invert (list 'quote function)))))
3102
3103 (defmacro byte-defop-compiler-1 (function &optional compile-handler) 3010 (defmacro byte-defop-compiler-1 (function &optional compile-handler)
3104 (list 'byte-defop-compiler (list function nil) compile-handler)) 3011 (list 'byte-defop-compiler (list function nil) compile-handler))
3105 3012
3106 3013
3107 (put 'byte-call 'byte-opcode-invert 'funcall) 3014 (put 'byte-call 'byte-opcode-invert 'funcall)
3119 ;; How old is this stuff? -slb 3026 ;; How old is this stuff? -slb
3120 ;(byte-defop-compiler (dot byte-point) 0+1) 3027 ;(byte-defop-compiler (dot byte-point) 0+1)
3121 ;(byte-defop-compiler (dot-max byte-point-max) 0+1) 3028 ;(byte-defop-compiler (dot-max byte-point-max) 0+1)
3122 ;(byte-defop-compiler (dot-min byte-point-min) 0+1) 3029 ;(byte-defop-compiler (dot-min byte-point-min) 0+1)
3123 (byte-defop-compiler point 0+1) 3030 (byte-defop-compiler point 0+1)
3124 (byte-defop-compiler-rmsfun eq 2) 3031 (byte-defop-compiler eq 2)
3125 (byte-defop-compiler point-max 0+1) 3032 (byte-defop-compiler point-max 0+1)
3126 (byte-defop-compiler point-min 0+1) 3033 (byte-defop-compiler point-min 0+1)
3127 (byte-defop-compiler following-char 0+1) 3034 (byte-defop-compiler following-char 0+1)
3128 (byte-defop-compiler preceding-char 0+1) 3035 (byte-defop-compiler preceding-char 0+1)
3129 (byte-defop-compiler current-column 0+1) 3036 (byte-defop-compiler current-column 0+1)
3130 ;; FSF has special function here; generalized here by the 1+2 stuff. 3037 ;; FSF has special function here; generalized here by the 1+2 stuff.
3131 (byte-defop-compiler (indent-to-column byte-indent-to) 1+2) 3038 (byte-defop-compiler (indent-to-column byte-indent-to) 1+2)
3132 (byte-defop-compiler indent-to 1+2) 3039 (byte-defop-compiler indent-to 1+2)
3133 (byte-defop-compiler-rmsfun equal 2) 3040 (byte-defop-compiler equal 2)
3134 (byte-defop-compiler eolp 0+1) 3041 (byte-defop-compiler eolp 0+1)
3135 (byte-defop-compiler eobp 0+1) 3042 (byte-defop-compiler eobp 0+1)
3136 (byte-defop-compiler bolp 0+1) 3043 (byte-defop-compiler bolp 0+1)
3137 (byte-defop-compiler bobp 0+1) 3044 (byte-defop-compiler bobp 0+1)
3138 (byte-defop-compiler current-buffer 0) 3045 (byte-defop-compiler current-buffer 0)
3139 ;;(byte-defop-compiler read-char 0) ;; obsolete 3046 ;;(byte-defop-compiler read-char 0) ;; obsolete
3140 (byte-defop-compiler-rmsfun memq 2) 3047 (byte-defop-compiler memq 2)
3141 (byte-defop-compiler interactive-p 0) 3048 (byte-defop-compiler interactive-p 0)
3142 (byte-defop-compiler widen 0+1) 3049 (byte-defop-compiler widen 0+1)
3143 (byte-defop-compiler end-of-line 0-1+1) 3050 (byte-defop-compiler end-of-line 0-1+1)
3144 (byte-defop-compiler forward-char 0-1+1) 3051 (byte-defop-compiler forward-char 0-1+1)
3145 (byte-defop-compiler forward-line 0-1+1) 3052 (byte-defop-compiler forward-line 0-1+1)
3168 (byte-defop-compiler numberp 1) 3075 (byte-defop-compiler numberp 1)
3169 (byte-defop-compiler fixnump 1) 3076 (byte-defop-compiler fixnump 1)
3170 (byte-defop-compiler skip-chars-forward 1-2+1) 3077 (byte-defop-compiler skip-chars-forward 1-2+1)
3171 (byte-defop-compiler skip-chars-backward 1-2+1) 3078 (byte-defop-compiler skip-chars-backward 1-2+1)
3172 (byte-defop-compiler eq 2) 3079 (byte-defop-compiler eq 2)
3173 ; (byte-defop-compiler20 old-eq 2) 3080 ; (byte-defop-compiler old-eq 2)
3174 ; (byte-defop-compiler20 old-memq 2) 3081 ; (byte-defop-compiler old-memq 2)
3175 (byte-defop-compiler cons 2) 3082 (byte-defop-compiler cons 2)
3176 (byte-defop-compiler aref 2) 3083 (byte-defop-compiler aref 2)
3177 (byte-defop-compiler get 2+1) 3084 (byte-defop-compiler get 2+1)
3178 (byte-defop-compiler nth 2) 3085 (byte-defop-compiler nth 2)
3179 (byte-defop-compiler subseq byte-compile-subseq) 3086 (byte-defop-compiler subseq byte-compile-subseq)
3186 (byte-defop-compiler downcase 1+1) 3093 (byte-defop-compiler downcase 1+1)
3187 (byte-defop-compiler string= 2) 3094 (byte-defop-compiler string= 2)
3188 (byte-defop-compiler string< 2) 3095 (byte-defop-compiler string< 2)
3189 (byte-defop-compiler (string-equal byte-string=) 2) 3096 (byte-defop-compiler (string-equal byte-string=) 2)
3190 (byte-defop-compiler (string-lessp byte-string<) 2) 3097 (byte-defop-compiler (string-lessp byte-string<) 2)
3191 ; (byte-defop-compiler20 old-equal 2) 3098 ; (byte-defop-compiler old-equal 2)
3192 (byte-defop-compiler nthcdr 2) 3099 (byte-defop-compiler nthcdr 2)
3193 (byte-defop-compiler elt 2) 3100 (byte-defop-compiler elt 2)
3194 (byte-defop-compiler20 old-member 2) 3101 (byte-defop-compiler old-member 2)
3195 (byte-defop-compiler20 old-assq 2) 3102 (byte-defop-compiler old-assq 2)
3196 (byte-defop-compiler (rplaca byte-setcar) 2) 3103 (byte-defop-compiler (rplaca byte-setcar) 2)
3197 (byte-defop-compiler (rplacd byte-setcdr) 2) 3104 (byte-defop-compiler (rplacd byte-setcdr) 2)
3198 (byte-defop-compiler setcar 2) 3105 (byte-defop-compiler setcar 2)
3199 (byte-defop-compiler setcdr 2) 3106 (byte-defop-compiler setcdr 2)
3200 (byte-defop-compiler delete-region 2+1) 3107 (byte-defop-compiler delete-region 2+1)
3205 (byte-defop-compiler-1 bind-multiple-value-limits) 3112 (byte-defop-compiler-1 bind-multiple-value-limits)
3206 (byte-defop-compiler multiple-value-list-internal) 3113 (byte-defop-compiler multiple-value-list-internal)
3207 (byte-defop-compiler-1 multiple-value-call) 3114 (byte-defop-compiler-1 multiple-value-call)
3208 (byte-defop-compiler throw) 3115 (byte-defop-compiler throw)
3209 3116
3210 (byte-defop-compiler-rmsfun member 2) 3117 (byte-defop-compiler member 2)
3211 (byte-defop-compiler-rmsfun assq 2) 3118 (byte-defop-compiler assq 2)
3212 3119
3213 ;;####(byte-defop-compiler move-to-column 1) 3120 ;;####(byte-defop-compiler move-to-column 1)
3214 (byte-defop-compiler-1 interactive byte-compile-noop) 3121 (byte-defop-compiler-1 interactive byte-compile-noop)
3215 (byte-defop-compiler-1 domain byte-compile-domain) 3122 (byte-defop-compiler-1 domain byte-compile-domain)
3216 3123
3348 (defun byte-compile-one-arg-with-two-extra (form) 3255 (defun byte-compile-one-arg-with-two-extra (form)
3349 (case (length (cdr form)) 3256 (case (length (cdr form))
3350 (1 (byte-compile-one-arg form)) 3257 (1 (byte-compile-one-arg form))
3351 ((2 3) (byte-compile-normal-call form)) 3258 ((2 3) (byte-compile-normal-call form))
3352 (t (byte-compile-subr-wrong-args form "1-3")))) 3259 (t (byte-compile-subr-wrong-args form "1-3"))))
3353
3354 ;; XEmacs: used for functions that have a different opcode in v19 than v20.
3355 ;; this includes `eq', `equal', and other old-ified functions.
3356 (defun byte-compile-two-args-19->20 (form)
3357 (if (not (eql (length form) 3))
3358 (byte-compile-subr-wrong-args form 2)
3359 (byte-compile-form (car (cdr form))) ;; Push the arguments
3360 (byte-compile-form (nth 2 form))
3361 (if (byte-compile-version-cond byte-compile-emacs19-compatibility)
3362 (byte-compile-out (get (car form) 'byte-opcode19) 0)
3363 (byte-compile-out (get (car form) 'byte-opcode) 0))))
3364 3260
3365 (defun byte-compile-noop (form) 3261 (defun byte-compile-noop (form)
3366 (byte-compile-constant nil)) 3262 (byte-compile-constant nil))
3367 3263
3368 (defun byte-compile-discard () 3264 (defun byte-compile-discard ()
4303 (byte-compile-out 'byte-save-restriction 0) 4199 (byte-compile-out 'byte-save-restriction 0)
4304 (byte-compile-body-do-effect (cdr form)) 4200 (byte-compile-body-do-effect (cdr form))
4305 (byte-compile-out 'byte-unbind 1)) 4201 (byte-compile-out 'byte-unbind 1))
4306 4202
4307 (defun byte-compile-save-current-buffer (form) 4203 (defun byte-compile-save-current-buffer (form)
4308 (if (byte-compile-version-cond byte-compile-emacs19-compatibility) 4204 (byte-compile-out 'byte-save-current-buffer 0)
4309 ;; `save-current-buffer' special operator is not available in XEmacs 19. 4205 (byte-compile-body-do-effect (cdr form))
4310 (byte-compile-form 4206 (byte-compile-out 'byte-unbind 1))
4311 `(let ((_byte_compiler_save_buffer_emulation_closure_ (current-buffer)))
4312 (unwind-protect
4313 (progn ,@(cdr form))
4314 (and (buffer-live-p _byte_compiler_save_buffer_emulation_closure_)
4315 (set-buffer _byte_compiler_save_buffer_emulation_closure_)))))
4316 (byte-compile-out 'byte-save-current-buffer 0)
4317 (byte-compile-body-do-effect (cdr form))
4318 (byte-compile-out 'byte-unbind 1)))
4319 4207
4320 (defun byte-compile-with-output-to-temp-buffer (form) 4208 (defun byte-compile-with-output-to-temp-buffer (form)
4321 (byte-compile-form (car (cdr form))) 4209 (byte-compile-form (car (cdr form)))
4322 (byte-compile-out 'byte-temp-output-buffer-setup 0) 4210 (byte-compile-out 'byte-temp-output-buffer-setup 0)
4323 (byte-compile-body (cdr (cdr form))) 4211 (byte-compile-body (cdr (cdr form)))
4875 ;; To avoid "lisp nesting exceeds max-lisp-eval-depth" when bytecomp compiles 4763 ;; To avoid "lisp nesting exceeds max-lisp-eval-depth" when bytecomp compiles
4876 ;; itself, compile some of its most used recursive functions (at load time). 4764 ;; itself, compile some of its most used recursive functions (at load time).
4877 ;; 4765 ;;
4878 (eval-when-compile 4766 (eval-when-compile
4879 (or (compiled-function-p (symbol-function 'byte-compile-form)) 4767 (or (compiled-function-p (symbol-function 'byte-compile-form))
4880 (assq 'byte-code (symbol-function 'byte-compile-form))
4881 (let ((byte-optimize nil) ; do it fast 4768 (let ((byte-optimize nil) ; do it fast
4882 (byte-compile-warnings nil)) 4769 (byte-compile-warnings nil))
4883 (mapcar #'(lambda (x) 4770 (map nil (if noninteractive
4884 (or noninteractive (message "compiling %s..." x)) 4771 #'byte-compile
4885 (byte-compile x) 4772 #'(lambda (x)
4886 (or noninteractive (message "compiling %s...done" x))) 4773 (message "compiling %s..." x)
4887 '(byte-compile-normal-call 4774 (byte-compile x)
4888 byte-compile-form 4775 (message "compiling %s...done" x)))
4889 byte-compile-body 4776 '(byte-compile-normal-call
4890 ;; Inserted some more than necessary, to speed it up. 4777 byte-compile-form
4891 byte-compile-top-level 4778 byte-compile-body
4892 byte-compile-out-toplevel 4779 ;; Inserted some more than necessary, to speed it up.
4893 byte-compile-constant 4780 byte-compile-top-level
4894 byte-compile-variable-ref)))) 4781 byte-compile-out-toplevel
4895 nil) 4782 byte-compile-constant
4783 byte-compile-variable-ref)))))
4784
4896 4785
4897 (run-hooks 'bytecomp-load-hook) 4786 (run-hooks 'bytecomp-load-hook)
4898 4787
4899 ;;; bytecomp.el ends here 4788 ;;; bytecomp.el ends here