summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/byte-opt.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-02-11 17:30:02 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-11 17:30:02 -0500
commit295fb2ac59b66c0e2470325a42c8e58c135ed044 (patch)
tree79a1ad28fff71252a5d19b49b1d2a6827849039c /lisp/emacs-lisp/byte-opt.el
parent43e67019dfc4fb7d3474e0fbedcfec60f2300521 (diff)
downloademacs-295fb2ac59b66c0e2470325a42c8e58c135ed044.tar.gz
emacs-295fb2ac59b66c0e2470325a42c8e58c135ed044.tar.bz2
emacs-295fb2ac59b66c0e2470325a42c8e58c135ed044.zip
Let cconv use :fun-body in special forms that need it.
* lisp/emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg. (cconv-closure-convert-toplevel): Remove. (cconv-lookup-let): New fun. (cconv-closure-convert-rec): Don't bother with defs-are-legal. Use :fun-body to handle special forms that require closing their forms. * lisp/emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile): Use cconv-closure-convert instead of cconv-closure-convert-toplevel. (byte-compile-lambda, byte-compile-make-closure): * lisp/emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment): Make sure cconv did its job. * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth before using it. * lisp/dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as function argument.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r--lisp/emacs-lisp/byte-opt.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 02107b0e11f..97ed6a01c2f 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1863,7 +1863,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;;
;; stack-ref-N --> dup ; where N is TOS
;;
- ((and (eq (car lap0) 'byte-stack-ref)
+ ((and stack-depth (eq (car lap0) 'byte-stack-ref)
(= (cdr lap0) (1- stack-depth)))
(setcar lap0 'byte-dup)
(setcdr lap0 nil)
@@ -2093,7 +2093,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;; stack-set-M [discard/discardN ...] --> discardN-preserve-tos
;; stack-set-M [discard/discardN ...] --> discardN
;;
- ((and (eq (car lap0) 'byte-stack-set)
+ ((and stack-depth ;Make sure we know the stack depth.
+ (eq (car lap0) 'byte-stack-set)
(memq (car lap1) '(byte-discard byte-discardN))
(progn
;; See if enough discard operations follow to expose or
@@ -2161,7 +2162,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;; dup return --> return
;; stack-set-N return --> return ; where N is TOS-1
;;
- ((and (eq (car lap1) 'byte-return)
+ ((and stack-depth ;Make sure we know the stack depth.
+ (eq (car lap1) 'byte-return)
(or (memq (car lap0) '(byte-discardN-preserve-tos byte-dup))
(and (eq (car lap0) 'byte-stack-set)
(= (cdr lap0) (- stack-depth 2)))))
@@ -2174,7 +2176,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
;;
;; dup stack-set-N return --> return ; where N is TOS
;;
- ((and (eq (car lap0) 'byte-dup)
+ ((and stack-depth ;Make sure we know the stack depth.
+ (eq (car lap0) 'byte-dup)
(eq (car lap1) 'byte-stack-set)
(eq (car (car (cdr (cdr rest)))) 'byte-return)
(= (cdr lap1) (1- stack-depth)))