aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVibhav Pant2017-02-06 13:26:25 +0530
committerVibhav Pant2017-02-06 13:26:25 +0530
commita12b416bca705c555ba049b18598533d3ae41ef2 (patch)
treeb4c80e6d6c6abffb89fc300fd7ea3c34a9febcee
parentad70ca1dad26da79f0a95cc0ec687902ef20fa9b (diff)
downloademacs-a12b416bca705c555ba049b18598533d3ae41ef2.tar.gz
emacs-a12b416bca705c555ba049b18598533d3ae41ef2.zip
; byte(-opt, comp).el: Add more documentation for byte-switch code.
-rw-r--r--lisp/emacs-lisp/byte-opt.el3
-rw-r--r--lisp/emacs-lisp/bytecomp.el19
2 files changed, 22 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 146fbcc1cb6..888a5f85007 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."
1773 ;; 1773 ;;
1774 ((and (memq (car lap0) '(byte-goto byte-return)) 1774 ((and (memq (car lap0) '(byte-goto byte-return))
1775 (not (memq (car lap1) '(TAG nil))) 1775 (not (memq (car lap1) '(TAG nil)))
1776 ;; FIXME: Instead of deferring simply when jump-tables are
1777 ;; being used, keep a list of tags used for switch tags and
1778 ;; use them instead (see `byte-compile-inline-lapcode').
1776 (not byte-compile-jump-tables)) 1779 (not byte-compile-jump-tables))
1777 (setq tmp rest) 1780 (setq tmp rest)
1778 (let ((i 0) 1781 (let ((i 0)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 5aef82691c6..c70e1bf5ed8 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."
3133 ;; happens to be true for byte-code generated by bytecomp.el without 3133 ;; happens to be true for byte-code generated by bytecomp.el without
3134 ;; lexical-binding, but it's not true in general, and it's not true for 3134 ;; lexical-binding, but it's not true in general, and it's not true for
3135 ;; code output by bytecomp.el with lexical-binding. 3135 ;; code output by bytecomp.el with lexical-binding.
3136 ;; We also restore the value of `byte-compile-depth' and remove TAG depths
3137 ;; accordingly when inlining byte-switch lap code, as documented in
3138 ;; `byte-compile-cond-jump-table'.
3136 (let ((endtag (byte-compile-make-tag)) 3139 (let ((endtag (byte-compile-make-tag))
3137 last-jump-tag ;; last TAG we have jumped to 3140 last-jump-tag ;; last TAG we have jumped to
3138 last-depth ;; last value of `byte-compile-depth' 3141 last-depth ;; last value of `byte-compile-depth'
@@ -4061,6 +4064,22 @@ Return a list of the form ((TEST . VAR) ((VALUE BODY) ...))"
4061 (length cases))) 4064 (length cases)))
4062 default-tag (byte-compile-make-tag) 4065 default-tag (byte-compile-make-tag)
4063 donetag (byte-compile-make-tag)) 4066 donetag (byte-compile-make-tag))
4067 ;; The structure of byte-switch code:
4068 ;;
4069 ;; varref var
4070 ;; constant #s(hash-table purecopy t data (val1 (TAG1) val2 (TAG2)))
4071 ;; switch
4072 ;; goto DEFAUT-TAG
4073 ;; TAG1
4074 ;; <clause body>
4075 ;; goto DONETAG
4076 ;; TAG2
4077 ;; <clause body>
4078 ;; goto DONETAG
4079 ;; DEFAULT-TAG
4080 ;; <body for `t' clause, if any (else `constant nil')>
4081 ;; DONETAG
4082
4064 (byte-compile-variable-ref var) 4083 (byte-compile-variable-ref var)
4065 (byte-compile-push-constant jump-table) 4084 (byte-compile-push-constant jump-table)
4066 (byte-compile-out 'byte-switch) 4085 (byte-compile-out 'byte-switch)