]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor.
authorAndrea Corallo <akrl@sdf.org>
Thu, 1 Jun 2023 09:02:01 +0000 (11:02 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 1 Jun 2023 09:48:24 +0000 (11:48 +0200)
lisp/emacs-lisp/comp.el

index ec51f805c2bec7999fcc532d8473a483349457fd..b2704ae1446e7bdf3351b7baa17248cc0f0a7e7a 100644 (file)
@@ -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."