summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cconv.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-03-16 16:08:39 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2011-03-16 16:08:39 -0400
commitca1055060d5793e368c1a165c412944d6800c3a6 (patch)
tree81c850f1a6fdee4a2faea041d72212569bc6ff4f /lisp/emacs-lisp/cconv.el
parent2663659f1f1a8566cf0f602969f85965a398f618 (diff)
downloademacs-ca1055060d5793e368c1a165c412944d6800c3a6.tar.gz
Remove bytecomp- prefix, plus misc changes.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Make it work to inline lexbind interpreted functions into lexbind code. (bytedecomp-bytes): Not a dynamic var any more. (disassemble-offset): Get the bytes via an argument instead. (byte-decompile-bytecode-1): Use push. * lisp/emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use lexical-binding. (byte-compile-outbuffer): Rename from bytecomp-outbuffer. * lisp/emacs-lisp/cl-macs.el (load-time-value): * lisp/emacs-lisp/cl.el (cl-compiling-file): Adjust to new name. * lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates): Add byte-code-function-p. (pcase--u1): Remove left-over code from early development. Fix case of variable shadowing in guards and predicates. (pcase--u1): Add a new `let' pattern. * src/image.c (parse_image_spec): Use Ffunctionp. * src/lisp.h: Declare Ffunctionp.
Diffstat (limited to 'lisp/emacs-lisp/cconv.el')
-rw-r--r--lisp/emacs-lisp/cconv.el31
1 files changed, 20 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 2229be0de58..5d19bf969e6 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -65,8 +65,16 @@
;;
;;; Code:
-;; TODO:
+;; TODO: (not just for cconv but also for the lexbind changes in general)
+;; - inline lexical byte-code functions.
+;; - investigate some old v18 stuff in bytecomp.el.
+;; - optimize away unused cl-block-wrapper.
+;; - let (e)debug find the value of lexical variables from the stack.
;; - byte-optimize-form should be applied before cconv.
+;; OTOH, the warnings emitted by cconv-analyze need to come before optimize
+;; since afterwards they can because obnoxious (warnings about an "unused
+;; variable" should not be emitted when the variable use has simply been
+;; optimized away).
;; - canonize code in macro-expand so we don't have to handle (let (var) body)
;; and other oddities.
;; - new byte codes for unwind-protect, catch, and condition-case so that
@@ -213,7 +221,7 @@ Returns a form where all lambdas don't have any free variables."
(if (assq arg new-env) (push `(,arg) new-env))
(push `(,arg . (car ,arg)) new-env)
(push `(,arg (list ,arg)) letbind)))
-
+
(setq body-new (mapcar (lambda (form)
(cconv-convert form new-env nil))
body))
@@ -255,7 +263,7 @@ places where they originally did not directly appear."
(cconv--set-diff (cdr (cddr mapping))
extend)))
env))))
-
+
;; What's the difference between fvrs and envs?
;; Suppose that we have the code
;; (lambda (..) fvr (let ((fvr 1)) (+ fvr 1)))
@@ -377,6 +385,7 @@ places where they originally did not directly appear."
; first element is lambda expression
(`(,(and `(lambda . ,_) fun) . ,args)
;; FIXME: it's silly to create a closure just to call it.
+ ;; Running byte-optimize-form earlier will resolve this.
`(funcall
,(cconv-convert `(function ,fun) env extend)
,@(mapcar (lambda (form)
@@ -486,9 +495,9 @@ places where they originally did not directly appear."
`(interactive . ,(mapcar (lambda (form)
(cconv-convert form nil nil))
forms)))
-
+
(`(declare . ,_) form) ;The args don't contain code.
-
+
(`(,func . ,forms)
;; First element is function or whatever function-like forms are: or, and,
;; if, progn, prog1, prog2, while, until
@@ -623,7 +632,7 @@ and updates the data stored in ENV."
(`(function (lambda ,vrs . ,body-forms))
(cconv--analyse-function vrs body-forms env form))
-
+
(`(setq . ,forms)
;; If a local variable (member of env) is modified by setq then
;; it is a mutated variable.
@@ -646,8 +655,8 @@ and updates the data stored in ENV."
(`(condition-case ,var ,protected-form . ,handlers)
;; FIXME: The bytecode for condition-case forces us to wrap the
- ;; form and handlers in closures (for handlers, it's probably
- ;; unavoidable, but not for the protected form).
+ ;; form and handlers in closures (for handlers, it's understandable
+ ;; but not for the protected form).
(cconv--analyse-function () (list protected-form) env form)
(dolist (handler handlers)
(cconv--analyse-function (if var (list var)) (cdr handler) env form)))
@@ -657,8 +666,8 @@ and updates the data stored in ENV."
(cconv-analyse-form form env)
(cconv--analyse-function () body env form))
- ;; FIXME: The bytecode for save-window-excursion and the lack of
- ;; bytecode for track-mouse forces us to wrap the body.
+ ;; FIXME: The lack of bytecode for track-mouse forces us to wrap the body.
+ ;; `track-mouse' really should be made into a macro.
(`(track-mouse . ,body)
(cconv--analyse-function () body env form))
@@ -686,7 +695,7 @@ and updates the data stored in ENV."
(dolist (form forms) (cconv-analyse-form form nil)))
(`(declare . ,_) nil) ;The args don't contain code.
-
+
(`(,_ . ,body-forms) ; First element is a function or whatever.
(dolist (form body-forms) (cconv-analyse-form form env)))