summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/byte-opt.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-11 22:32:43 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-11 22:32:43 -0500
commit2ec42da9f0ddaaa9197617eb3e5a9d18ad2ba942 (patch)
treedcfa222d39bd995e82374f077faa49247de6676e /lisp/emacs-lisp/byte-opt.el
parentba83908c4b7fda12991ae9073028a60da87c1fa2 (diff)
downloademacs-2ec42da9f0ddaaa9197617eb3e5a9d18ad2ba942.tar.gz
emacs-2ec42da9f0ddaaa9197617eb3e5a9d18ad2ba942.tar.bz2
emacs-2ec42da9f0ddaaa9197617eb3e5a9d18ad2ba942.zip
Try and fix w32 build; misc cleanup.
* lisp/subr.el (apply-partially): Move from subr.el; don't use lexical-let. (eval-after-load): Obey lexical-binding. * lisp/simple.el (apply-partially): Move to subr.el. * lisp/makefile.w32-in: Match changes in Makefile.in. (BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars. (.el.elc, compile-CMD, compile-SH, compile-always-CMD) (compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them. (COMPILE_FIRST): Add pcase, macroexp, and cconv. * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about calling CL's `compiler-macroexpand'. * lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): New function. (byte-compile-initial-macro-environment) (byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp): Use it. (byte-compile-eval, byte-compile-eval-before-compile): Obey lexical-binding. (byte-compile--for-effect): Rename from `for-effect'. (display-call-tree): Use case. * lisp/emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic. (byte-optimize-form-code-walker, byte-optimize-form): Revert to old arg name. * lisp/Makefile.in (BYTE_COMPILE_FLAGS): New var. (compile-onefile, .el.elc, compile-calc, recompile): Use it.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r--lisp/emacs-lisp/byte-opt.el33
1 files changed, 15 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index a4254bfeca1..b07d61ae0d1 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -308,9 +308,9 @@
;; ((lambda ...) ...)
(defun byte-compile-unfold-lambda (form &optional name)
;; In lexical-binding mode, let and functions don't bind vars in the same way
- ;; (let obey special-variable-p, but functions don't). This doesn't matter
- ;; here, because function's behavior is underspecified so it can safely be
- ;; turned into a `let', even though the reverse is not true.
+ ;; (let obey special-variable-p, but functions don't). But luckily, this
+ ;; doesn't matter here, because function's behavior is underspecified so it
+ ;; can safely be turned into a `let', even though the reverse is not true.
(or name (setq name "anonymous lambda"))
(let ((lambda (car form))
(values (cdr form)))
@@ -378,9 +378,7 @@
;;; implementing source-level optimizers
-(defvar for-effect)
-
-(defun byte-optimize-form-code-walker (form for-effect-arg)
+(defun byte-optimize-form-code-walker (form for-effect)
;;
;; For normal function calls, We can just mapcar the optimizer the cdr. But
;; we need to have special knowledge of the syntax of the special forms
@@ -388,8 +386,7 @@
;; the important aspect is that they are subrs that don't evaluate all of
;; their args.)
;;
- (let ((for-effect for-effect-arg)
- (fn (car-safe form))
+ (let ((fn (car-safe form))
tmp)
(cond ((not (consp form))
(if (not (and for-effect
@@ -482,8 +479,8 @@
(byte-optimize-form (nth 2 form) for-effect)
(byte-optimize-body (nthcdr 3 form) for-effect)))))
- ((memq fn '(and or)) ; remember, and/or are control structures.
- ;; take forms off the back until we can't any more.
+ ((memq fn '(and or)) ; Remember, and/or are control structures.
+ ;; Take forms off the back until we can't any more.
;; In the future it could conceivably be a problem that the
;; subexpressions of these forms are optimized in the reverse
;; order, but it's ok for now.
@@ -498,7 +495,8 @@
(byte-compile-log
" all subforms of %s called for effect; deleted" form))
(and backwards
- (cons fn (nreverse (mapcar 'byte-optimize-form backwards)))))
+ (cons fn (nreverse (mapcar 'byte-optimize-form
+ backwards)))))
(cons fn (mapcar 'byte-optimize-form (cdr form)))))
((eq fn 'interactive)
@@ -537,8 +535,8 @@
;; However, don't actually bother calling `ignore'.
`(prog1 nil . ,(mapcar 'byte-optimize-form (cdr form))))
- ((eq fn 'internal-make-closure)
- form)
+ ;; Neeeded as long as we run byte-optimize-form after cconv.
+ ((eq fn 'internal-make-closure) form)
((not (symbolp fn))
(debug)
@@ -589,19 +587,18 @@
(setq list (cdr list)))
constant))
-(defun byte-optimize-form (form &optional for-effect-arg)
+(defun byte-optimize-form (form &optional for-effect)
"The source-level pass of the optimizer."
;;
;; First, optimize all sub-forms of this one.
- (setq form (byte-optimize-form-code-walker form for-effect-arg))
+ (setq form (byte-optimize-form-code-walker form for-effect))
;;
;; after optimizing all subforms, optimize this form until it doesn't
;; optimize any further. This means that some forms will be passed through
;; the optimizer many times, but that's necessary to make the for-effect
;; processing do as much as possible.
;;
- (let ((for-effect for-effect-arg)
- opt new)
+ (let (opt new)
(if (and (consp form)
(symbolp (car form))
(or (and for-effect
@@ -618,7 +615,7 @@
(defun byte-optimize-body (forms all-for-effect)
- ;; optimize the cdr of a progn or implicit progn; all forms is a list of
+ ;; Optimize the cdr of a progn or implicit progn; all forms is a list of
;; forms, all but the last of which are optimized with the assumption that
;; they are being called for effect. the last is for-effect as well if
;; all-for-effect is true. returns a new list of forms.