emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 71b9019: byte-opt: Replace merged tags in jump tabl


From: Vibhav Pant
Subject: [Emacs-diffs] master 71b9019: byte-opt: Replace merged tags in jump tables too. (bug#25716)
Date: Tue, 14 Feb 2017 11:24:30 -0500 (EST)

branch: master
commit 71b90192dab8de9825904faaabbaf9548d3db2ab
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>

    byte-opt: Replace merged tags in jump tables too. (bug#25716)
    
    * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): While merging
      adjacent tags, make sure that the old tag is replaced in all jump
      tables, if any. This fixes the bytecode VM jumping to the wrong
      address in compiled cond forms where the body of a clause was a loop
      of any sort.
---
 lisp/emacs-lisp/byte-opt.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 38f5dcc..f3cc3d5 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1752,12 +1752,22 @@ If FOR-EFFECT is non-nil, the return value is assumed 
to be of no importance."
                 (setcdr tmp2 lap1)
                 (setq tmp3 (cdr (memq tmp2 tmp3))))
               (setq lap (delq lap0 lap)
-                    keep-going t))
+                    keep-going t)
+               ;; replace references to tag in jump tables, if any
+               (dolist (table byte-compile-jump-tables)
+                 (catch 'break
+                   (maphash #'(lambda (value tag)
+                                (when (equal tag lap0)
+                                  ;; each tag occurs only once in the jump 
table
+                                  (puthash value lap1 table)
+                                  (throw 'break nil)))
+                            table))))
              ;;
              ;; unused-TAG: --> <deleted>
              ;;
              ((and (eq 'TAG (car lap0))
                    (not (rassq lap0 lap))
+                    ;; make sure this tag isn't used in a jump-table
                     (cl-loop for table in byte-compile-jump-tables
                              when (member lap0 (hash-table-values table))
                              return nil finally return t))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]