From: Andrea Corallo Date: Thu, 1 Jun 2023 09:02:01 +0000 (+0200) Subject: * lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dacc535a80ef284020ca9b0abc7b1c2f3d544d29;p=emacs.git * lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor. --- diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index ec51f805c2b..b2704ae1446 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1723,17 +1723,11 @@ Return value is the fall-through block name." ;; (byte-constant #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (created 126 deleted 126 changed 126)) . 24) ;; (byte-switch) ;; (TAG 126 . 10) - (cl-loop - with labels = (cl-loop for target-label being each hash-value of jmp-table - collect target-label) - with x = (car labels) - for l in (cdr-safe labels) - unless (= l x) - return nil - finally return (pcase (nth (1+ (comp-limplify-pc comp-pass)) - (comp-func-lap comp-func)) - (`(TAG ,label . ,_label-sp) - (= label l))))) + (let ((targets (hash-table-values jmp-table))) + (when (apply #'= targets) + (pcase (nth (1+ (comp-limplify-pc comp-pass)) (comp-func-lap comp-func)) + (`(TAG ,target . ,_label-sp) + (= target (car targets))))))) (defun comp-emit-switch (var last-insn) "Emit a Limple for a lap jump table given VAR and LAST-INSN."