Ignore:
Timestamp:
07/29/10 18:27:10 (13 years ago)
Author:
ehuelsmann
Message:

Lots of fixes from writing tests. Most notable the correction of
my perception that the exceptions table was stored as an attribute
of the "Code" attribute. It's not: it's part of said attribute.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12806 r12832  
    13051305          (return-from walk-code))))))
    13061306
    1307 (declaim (ftype (function () t) analyze-stack))
    1308 (defun analyze-stack ()
     1307(declaim (ftype (function (t) t) analyze-stack))
     1308(defun analyze-stack (code)
    13091309  (declare (optimize speed))
    1310   (let* ((code *code*)
    1311          (code-length (length code)))
     1310  (let* ((code-length (length code)))
    13121311    (declare (type vector code))
    13131312    (dotimes (i code-length)
     
    15731572
    15741573(defun code-bytes (code)
    1575   (let ((length 0))
     1574  (let ((length 0)
     1575        labels ;; alist
     1576        )
    15761577    (declare (type (unsigned-byte 16) length))
    15771578    ;; Pass 1: calculate label offsets and overall length.
     
    15821583        (if (= opcode 202) ; LABEL
    15831584            (let ((label (car (instruction-args instruction))))
    1584               (set label length))
     1585              (set label length)
     1586              (setf labels
     1587                    (acons label length labels)))
    15851588            (incf length (opcode-size opcode)))))
    15861589    ;; Pass 2: replace labels with calculated offsets.
     
    16091612              (setf (svref bytes index) byte)
    16101613              (incf index)))))
    1611       bytes)))
     1614      (values bytes labels))))
    16121615
    16131616(declaim (inline write-u1))
     
    18791882    (finalize-code)
    18801883    (setf *code* (resolve-instructions *code*))
    1881     (setf (method-max-stack constructor) (analyze-stack))
     1884    (setf (method-max-stack constructor) (analyze-stack *code*))
    18821885    (setf (method-code constructor) (code-bytes *code*))
    18831886    (setf (method-handlers constructor) (nreverse *handlers*))
     
    82068209
    82078210    (setf *code* (resolve-instructions *code*))
    8208     (setf (method-max-stack execute-method) (analyze-stack))
     8211    (setf (method-max-stack execute-method) (analyze-stack *code*))
    82098212    (setf (method-code execute-method) (code-bytes *code*))
    82108213
Note: See TracChangeset for help on using the changeset viewer.