From dde800c8c9ea198996229d03df1fc45c7d057339 Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Thu, 9 Feb 2017 12:18:54 +0530 Subject: Improve byte-switch execution. * lisp/emacs-lisp/byte-opt.el, lisp/emacs-lisp/bytecomp.el (byte-decompile-bytecode-1), (byte-compile-lapcode): Calculate the actual jump address while compiling, store it in the jump table. * src/bytecode.c: Jump to the looked up value directly, do a linear search when the number of elements is <= 5. --- lisp/emacs-lisp/byte-opt.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/byte-opt.el') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 888a5f85007..3bec3e61df9 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1411,10 +1411,8 @@ ;; Replace all addresses with TAGs. (maphash #'(lambda (value tag) (let (newtag) - (cl-assert (consp tag) - nil "Invalid address for byte-switch") (setq newtag (byte-compile-make-tag)) - (push (cons (+ (car tag) (lsh (cdr tag) 8)) newtag) tags) + (push (cons tag newtag) tags) (puthash value newtag last-constant))) last-constant) ;; Replace the hash table referenced in the lapcode with our -- cgit v1.2.3