]> code.delx.au - gnu-emacs/commitdiff
(byte-decompile-bytecode-1):
authorRichard M. Stallman <rms@gnu.org>
Wed, 20 Jul 1994 05:31:29 +0000 (05:31 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 20 Jul 1994 05:31:29 +0000 (05:31 +0000)
Put a pc value before each insn in the list we return.

lisp/emacs-lisp/byte-opt.el

index ed13938b36d79480a1aaca078275cbe58319db44..cb9f4ffab3ac676bfc7c1eb53728f88054aab6b8 100644 (file)
 ;;; 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)
        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
     ;; 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)))
     (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))))
 
 \f
 ;;; peephole optimizer