[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/byte-switch a12b416: ; byte(-opt, comp).el: Add mo
From: |
Vibhav Pant |
Subject: |
[Emacs-diffs] feature/byte-switch a12b416: ; byte(-opt, comp).el: Add more documentation for byte-switch code. |
Date: |
Mon, 6 Feb 2017 12:04:15 +0000 (UTC) |
branch: feature/byte-switch
commit a12b416bca705c555ba049b18598533d3ae41ef2
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>
; byte(-opt, comp).el: Add more documentation for byte-switch code.
---
lisp/emacs-lisp/byte-opt.el | 3 +++
lisp/emacs-lisp/bytecomp.el | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 146fbcc..888a5f8 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1773,6 +1773,9 @@ If FOR-EFFECT is non-nil, the return value is assumed to
be of no importance."
;;
((and (memq (car lap0) '(byte-goto byte-return))
(not (memq (car lap1) '(TAG nil)))
+ ;; FIXME: Instead of deferring simply when jump-tables are
+ ;; being used, keep a list of tags used for switch tags and
+ ;; use them instead (see `byte-compile-inline-lapcode').
(not byte-compile-jump-tables))
(setq tmp rest)
(let ((i 0)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5aef826..c70e1bf 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3133,6 +3133,9 @@ for symbols generated by the byte compiler itself."
;; happens to be true for byte-code generated by bytecomp.el without
;; lexical-binding, but it's not true in general, and it's not true for
;; code output by bytecomp.el with lexical-binding.
+ ;; We also restore the value of `byte-compile-depth' and remove TAG depths
+ ;; accordingly when inlining byte-switch lap code, as documented in
+ ;; `byte-compile-cond-jump-table'.
(let ((endtag (byte-compile-make-tag))
last-jump-tag ;; last TAG we have jumped to
last-depth ;; last value of `byte-compile-depth'
@@ -4061,6 +4064,22 @@ Return a list of the form ((TEST . VAR) ((VALUE BODY)
...))"
(length cases)))
default-tag (byte-compile-make-tag)
donetag (byte-compile-make-tag))
+ ;; The structure of byte-switch code:
+ ;;
+ ;; varref var
+ ;; constant #s(hash-table purecopy t data (val1 (TAG1) val2 (TAG2)))
+ ;; switch
+ ;; goto DEFAUT-TAG
+ ;; TAG1
+ ;; <clause body>
+ ;; goto DONETAG
+ ;; TAG2
+ ;; <clause body>
+ ;; goto DONETAG
+ ;; DEFAULT-TAG
+ ;; <body for `t' clause, if any (else `constant nil')>
+ ;; DONETAG
+
(byte-compile-variable-ref var)
(byte-compile-push-constant jump-table)
(byte-compile-out 'byte-switch)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] feature/byte-switch a12b416: ; byte(-opt, comp).el: Add more documentation for byte-switch code.,
Vibhav Pant <=