Changeset 12877


Ignore:
Timestamp:
08/08/10 13:16:53 (12 years ago)
Author:
ehuelsmann
Message:

Optimization functions optimize in tight loops, optimize for speed.
Also, remove iterator variable type declarations: our inferencer
knows their type.

File:
1 edited

Legend:

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

    r12876 r12877  
    734734    (declare (type vector code))
    735735    (dotimes (i code-length)
    736       (declare (type (unsigned-byte 16) i))
    737736      (let* ((instruction (aref code i))
    738737             (opcode (instruction-opcode instruction)))
     
    763762      (declare (type fixnum max-stack))
    764763      (dotimes (i code-length)
    765         (declare (type (unsigned-byte 16) i))
    766764        (let* ((instruction (aref code i))
    767765               (instruction-depth (instruction-depth instruction)))
     
    772770
    773771(defun delete-unused-labels (code handler-labels)
     772  (declare (optimize speed))
    774773  (let ((code (coerce code 'vector))
    775774        (changed nil)
     
    777776    ;; Mark the labels that are actually branched to.
    778777    (dotimes (i (length code))
    779       (declare (type (unsigned-byte 16) i))
    780778      (let ((instruction (aref code i)))
    781779        (when (branch-p (instruction-opcode instruction))
     
    787785    ;; Remove labels that are not used as branch targets.
    788786    (dotimes (i (length code))
    789       (declare (type (unsigned-byte 16) i))
    790787      (let ((instruction (aref code i)))
    791788        (when (= (instruction-opcode instruction) 202) ; LABEL
     
    800797(defun delete-unreachable-code (code)
    801798  ;; Look for unreachable code after GOTO.
     799  (declare (optimize speed))
    802800  (let* ((code (coerce code 'vector))
    803801         (changed nil)
     
    826824        (pending-labels '()))
    827825    (dotimes (i (length code))
    828       (declare (type (unsigned-byte 16) i))
    829826      (let ((instruction (aref code i)))
    830827        (cond ((label-p instruction)
     
    839836
    840837(defun optimize-jumps (code)
     838  (declare (optimize speed))
    841839  (let* ((code (coerce code 'vector))
    842840         (ht (label-target-instructions code))
    843841         (changed nil))
    844842    (dotimes (i (length code))
    845       (declare (type (unsigned-byte 16) i))
    846843      (let* ((instruction (aref code i))
    847844             (opcode (and instruction (instruction-opcode instruction))))
     
    867864         (changed nil))
    868865    (dotimes (i (1- (length code)))
    869       (declare (type (unsigned-byte 16) i))
    870866      (let* ((this-instruction (aref code i))
    871867             (this-opcode (and this-instruction
Note: See TracChangeset for help on using the changeset viewer.