emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] feature/byte-switch 4e6140b 5/5: * lisp/emacs-lisp/disass.


From: Vibhav Pant
Subject: [Emacs-diffs] feature/byte-switch 4e6140b 5/5: * lisp/emacs-lisp/disass.el: Display jump tables for switch.
Date: Wed, 25 Jan 2017 19:33:42 +0000 (UTC)

branch: feature/byte-switch
commit 4e6140b28324a9a63d54084c920206d00aed094e
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>

    * lisp/emacs-lisp/disass.el: Display jump tables for switch.
---
 lisp/emacs-lisp/disass.el |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 97e45e0..22c1c96 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -221,9 +221,17 @@ OBJ should be a call to BYTE-CODE generated by the byte 
compiler."
                ((memq op '(byte-constant byte-constant2))
                 ;; it's a constant
                 (setq arg (car arg))
-                ;; but if the value of the constant is compiled code, then
-                ;; recursively disassemble it.
-                (cond ((or (byte-code-function-p arg)
+                 ;; if the succeeding op is byte-switch, display the jump table
+                 ;; used
+                (cond ((eq (car-safe (car-safe (cdr lap))) 'byte-switch)
+                         (insert (format "<jump-table-%s ( " (hash-table-test 
arg)))
+                         (maphash #'(lambda (value tag)
+                                      (insert (format "%s %s " value (cadr 
tag))))
+                                  arg)
+                         (insert ")>"))
+                  ;; if the value of the constant is compiled code, then
+                  ;; recursively disassemble it.
+                  ((or (byte-code-function-p arg)
                            (and (consp arg) (functionp arg)
                                 (assq 'byte-code arg))
                            (and (eq (car-safe arg) 'macro)



reply via email to

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