Function: comp--jump-table-optimizable

comp--jump-table-optimizable is a byte-compiled function defined in comp.el.gz.

Signature

(comp--jump-table-optimizable JMP-TABLE)

Documentation

Return t if JMP-TABLE can be optimized out.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--jump-table-optimizable (jmp-table)
  "Return t if JMP-TABLE can be optimized out."
  ;; Identify LAP sequences like:
  ;; (byte-constant #s(hash-table test eq purecopy t data (created 126 deleted 126 changed 126)) . 24)
  ;; (byte-switch)
  ;; (TAG 126 . 10)
  (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)))))))