summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/byte-opt.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-07-20 05:31:29 +0000
committerRichard M. Stallman <rms@gnu.org>1994-07-20 05:31:29 +0000
commit41cf13b9dd25926bbe71c53da80bf713ac4b4837 (patch)
treeed74617d74cbe71d1004e1399403f0924e3b3484 /lisp/emacs-lisp/byte-opt.el
parent76bcdf397da641f3f82143b9cf2ba8a8a0b5b99e (diff)
downloademacs-41cf13b9dd25926bbe71c53da80bf713ac4b4837.tar.gz
emacs-41cf13b9dd25926bbe71c53da80bf713ac4b4837.tar.bz2
emacs-41cf13b9dd25926bbe71c53da80bf713ac4b4837.zip
(byte-decompile-bytecode-1):
Put a pc value before each insn in the list we return.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r--lisp/emacs-lisp/byte-opt.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index ed13938b36d..cb9f4ffab3a 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1083,6 +1083,8 @@
;;; This de-compiler is used for inline expansion of compiled functions,
;;; and by the disassembler.
;;;
+;;; This list contains numbers, which are pc values,
+;;; before each instruction.
(defun byte-decompile-bytecode (bytes constvec)
"Turns BYTECODE into lapcode, referring to CONSTVEC."
(let ((byte-compile-constants nil)
@@ -1101,6 +1103,7 @@
endtag
(retcount 0))
(while (not (= ptr length))
+ (setq lap (cons ptr lap))
(setq op (aref bytes ptr)
optr ptr
offset (disassemble-offset)) ; this does dynamic-scope magic
@@ -1135,7 +1138,8 @@
;; take off the dummy nil op that we replaced a trailing "return" with.
(let ((rest lap))
(while rest
- (cond ((setq tmp (assq (car (car rest)) tags))
+ (cond ((numberp (car rest)))
+ ((setq tmp (assq (car (car rest)) tags))
;; this addr is jumped to
(setcdr rest (cons (cons nil (cdr tmp))
(cdr rest)))
@@ -1148,7 +1152,11 @@
(if endtag
(setq lap (cons (cons nil endtag) lap)))
;; remove addrs, lap = ( [ (op . arg) | (TAG tagno) ]* )
- (mapcar 'cdr (nreverse lap))))
+ (mapcar (function (lambda (elt)
+ (if (numberp elt)
+ elt
+ (cdr elt))))
+ (nreverse lap))))
;;; peephole optimizer