diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 19 |
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." ;; ((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 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." ;; 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) |