diff options
| author | Stefan Monnier | 2024-03-04 23:42:50 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2024-03-04 23:42:50 -0500 |
| commit | 218748c26287ae865229fe8a3c520facfa12fede (patch) | |
| tree | 68ca9167e4c6b84a2330df39cc2b8bd976246158 | |
| parent | 418ad866bf846a6a3328d91df28c958be75337be (diff) | |
| download | emacs-218748c26287ae865229fe8a3c520facfa12fede.tar.gz emacs-218748c26287ae865229fe8a3c520facfa12fede.zip | |
disass.el (disassemble-1): Minor simplification
* lisp/emacs-lisp/disass.el (disassemble-1): Remove code for functions
of the form (lambda ARGS (byte-code ...)) which we don't use any
more nowadays.
| -rw-r--r-- | lisp/emacs-lisp/disass.el | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el index b7db2adde59..850cc2085f7 100644 --- a/lisp/emacs-lisp/disass.el +++ b/lisp/emacs-lisp/disass.el | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | (defun disassemble (object &optional buffer indent interactive-p) | 54 | (defun disassemble (object &optional buffer indent interactive-p) |
| 55 | "Print disassembled code for OBJECT in (optional) BUFFER. | 55 | "Print disassembled code for OBJECT in (optional) BUFFER. |
| 56 | OBJECT can be a symbol defined as a function, or a function itself | 56 | OBJECT can be a symbol defined as a function, or a function itself |
| 57 | \(a lambda expression or a compiled-function object). | 57 | \(a lambda expression or a byte-code-function object). |
| 58 | If OBJECT is not already compiled, we compile it, but do not | 58 | If OBJECT is not already compiled, we compile it, but do not |
| 59 | redefine OBJECT if it is a symbol." | 59 | redefine OBJECT if it is a symbol." |
| 60 | (interactive | 60 | (interactive |
| @@ -70,7 +70,7 @@ redefine OBJECT if it is a symbol." | |||
| 70 | (save-excursion | 70 | (save-excursion |
| 71 | (if (or interactive-p (null buffer)) | 71 | (if (or interactive-p (null buffer)) |
| 72 | (with-output-to-temp-buffer "*Disassemble*" | 72 | (with-output-to-temp-buffer "*Disassemble*" |
| 73 | (set-buffer "*Disassemble*") | 73 | (set-buffer standard-output) |
| 74 | (let ((lexical-binding lb)) | 74 | (let ((lexical-binding lb)) |
| 75 | (disassemble-internal object indent (not interactive-p)))) | 75 | (disassemble-internal object indent (not interactive-p)))) |
| 76 | (set-buffer buffer) | 76 | (set-buffer buffer) |
| @@ -250,29 +250,22 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler." | |||
| 250 | ;; if the succeeding op is byte-switch, display the jump table | 250 | ;; if the succeeding op is byte-switch, display the jump table |
| 251 | ;; used | 251 | ;; used |
| 252 | (cond ((eq (car-safe (car-safe (cdr lap))) 'byte-switch) | 252 | (cond ((eq (car-safe (car-safe (cdr lap))) 'byte-switch) |
| 253 | (insert (format "<jump-table-%s (" (hash-table-test arg))) | 253 | (insert (format "<jump-table-%s (" (hash-table-test arg))) |
| 254 | (let ((first-time t)) | 254 | (let ((first-time t)) |
| 255 | (maphash #'(lambda (value tag) | 255 | (maphash #'(lambda (value tag) |
| 256 | (if first-time | 256 | (if first-time |
| 257 | (setq first-time nil) | 257 | (setq first-time nil) |
| 258 | (insert " ")) | 258 | (insert " ")) |
| 259 | (insert (format "%s %s" value (cadr tag)))) | 259 | (insert (format "%s %s" value (cadr tag)))) |
| 260 | arg)) | 260 | arg)) |
| 261 | (insert ")>")) | 261 | (insert ")>")) |
| 262 | ;; if the value of the constant is compiled code, then | 262 | ;; if the value of the constant is compiled code, then |
| 263 | ;; recursively disassemble it. | 263 | ;; recursively disassemble it. |
| 264 | ((or (byte-code-function-p arg) | 264 | ((or (byte-code-function-p arg) |
| 265 | (and (consp arg) (functionp arg) | ||
| 266 | (assq 'byte-code arg)) | ||
| 267 | (and (eq (car-safe arg) 'macro) | 265 | (and (eq (car-safe arg) 'macro) |
| 268 | (or (byte-code-function-p (cdr arg)) | 266 | (byte-code-function-p (cdr arg)))) |
| 269 | (and (consp (cdr arg)) | ||
| 270 | (functionp (cdr arg)) | ||
| 271 | (assq 'byte-code (cdr arg)))))) | ||
| 272 | (cond ((byte-code-function-p arg) | 267 | (cond ((byte-code-function-p arg) |
| 273 | (insert "<compiled-function>\n")) | 268 | (insert "<compiled-function>\n")) |
| 274 | ((functionp arg) | ||
| 275 | (insert "<compiled lambda>")) | ||
| 276 | (t (insert "<compiled macro>\n"))) | 269 | (t (insert "<compiled macro>\n"))) |
| 277 | (disassemble-internal | 270 | (disassemble-internal |
| 278 | arg | 271 | arg |
| @@ -285,7 +278,7 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler." | |||
| 285 | (+ indent disassemble-recursive-indent))) | 278 | (+ indent disassemble-recursive-indent))) |
| 286 | ((eq (car-safe (car-safe arg)) 'byte-code) | 279 | ((eq (car-safe (car-safe arg)) 'byte-code) |
| 287 | (insert "(<byte code>...)\n") | 280 | (insert "(<byte code>...)\n") |
| 288 | (mapc ;recurse on list of byte-code objects | 281 | (mapc ;Recurse on list of byte-code objects. |
| 289 | (lambda (obj) | 282 | (lambda (obj) |
| 290 | (disassemble-1 | 283 | (disassemble-1 |
| 291 | obj | 284 | obj |