[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master dacc535a80e: * lisp/emacs-lisp/comp.el (comp-jump-table-optimizab
From: |
Andrea Corallo |
Subject: |
master dacc535a80e: * lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor. |
Date: |
Thu, 1 Jun 2023 05:50:28 -0400 (EDT) |
branch: master
commit dacc535a80ef284020ca9b0abc7b1c2f3d544d29
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor.
---
lisp/emacs-lisp/comp.el | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master dacc535a80e: * lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor.,
Andrea Corallo <=