summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cconv.el
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-01-20 12:25:26 -0700
committerTom Tromey <tom@tromey.com>2018-01-22 22:11:26 -0700
commit916094a84f0ab31be31aa6c3632f14176b4e882a (patch)
tree5d14b3b849b7b63f19577bd45bbbd85cdba0b702 /lisp/emacs-lisp/cconv.el
parenta6b4b9b4af5405b62cbd59f5ce23ca0fe0027ac7 (diff)
downloademacs-feature/byte-unwind-protect.tar.gz
Add new bytecodes for unwind-protectfeature/byte-unwind-protect
* lisp/emacs-lisp/byte-opt.el (disassemble-offset): Handle byte-pushunwindprotect. * lisp/emacs-lisp/bytecomp.el (byte-pushunwindprotect) (byte-endunwindprotect): New bytecodes. (byte-goto-ops): Add byte-pushunwindprotect. (byte-compile-unwind-protect): Emit new bytecodes. (byte-compile-goto): Handle byte-pushunwindprotect. * lisp/emacs-lisp/cconv.el (cconv-convert): Don't special-case unwind-protect when byte-compile--use-old-handlers. (cconv-analyze-form): Likewise. * src/bytecode.c (Bpushunwindprotect, Bendunwindprotect): New bytecodes. (exec_byte_code): Implement new bytecodes. * test/src/bytecode-tests.el: New file.
Diffstat (limited to 'lisp/emacs-lisp/cconv.el')
-rw-r--r--lisp/emacs-lisp/cconv.el7
1 files changed, 3 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 02fe794467b..925292483fd 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -87,7 +87,6 @@
;; command-history).
;; - canonize code in macro-expand so we don't have to handle (let (var) body)
;; and other oddities.
-;; - new byte codes for unwind-protect so that closures aren't needed at all.
;; - a reference to a var that is known statically to always hold a constant
;; should be turned into a byte-constant rather than a byte-stack-ref.
;; Hmm... right, that's called constant propagation and could be done here,
@@ -487,7 +486,8 @@ places where they originally did not directly appear."
handlers))))
(`(,(and head (or (and `catch (guard byte-compile--use-old-handlers))
- `unwind-protect))
+ (and `unwind-protect
+ (guard byte-compile--use-old-handlers))))
,form . ,body)
`(,head ,(cconv-convert form env extend)
:fun-body ,(cconv--convert-function () body env form)))
@@ -728,9 +728,8 @@ and updates the data stored in ENV."
(if var (cconv--analyze-use (cons (list var) (cdr varstruct))
form "variable"))))
- ;; FIXME: The bytecode for unwind-protect forces us to wrap the unwind.
(`(,(or (and `catch (guard byte-compile--use-old-handlers))
- `unwind-protect)
+ (and `unwind-protect (guard byte-compile--use-old-handlers)))
,form . ,body)
(cconv-analyze-form form env)
(cconv--analyze-function () body env form))