Changeset 12873


Ignore:
Timestamp:
08/07/10 20:41:22 (13 years ago)
Author:
ehuelsmann
Message:

In OPTIMIZE-JUMPS, optimize conditional jumps as well as
unconditional ones.

File:
1 edited

Legend:

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

    r12870 r12873  
    396396         (inline branch-p))
    397397(defun branch-p (opcode)
    398   (declare (optimize speed))
    399   (declare (type '(integer 0 255) opcode))
     398;;  (declare (optimize speed))
     399;;  (declare (type '(integer 0 255) opcode))
    400400  (or (<= 153 opcode 167)
    401401      (<= 198 opcode 200))) ;; ifnull / ifnonnull / goto_w
     
    844844    (dotimes (i (length code))
    845845      (declare (type (unsigned-byte 16) i))
    846       (let ((instruction (aref code i)))
    847         (when (and instruction (= (instruction-opcode instruction) 167)) ; GOTO
    848           ;; we're missing conditional jumps here?
     846      (let* ((instruction (aref code i))
     847             (opcode (and instruction (instruction-opcode instruction))))
     848        (when (and opcode (branch-p opcode))
    849849          (let* ((target-label (car (instruction-args instruction)))
    850850                 (next-instruction (gethash1 target-label ht)))
     
    856856                       changed t))
    857857                (176 ; ARETURN
    858                  (setf (instruction-opcode instruction) 176
    859                        (instruction-args instruction) nil
    860                        changed t))))))))
     858                 (when (unconditional-control-transfer-p opcode)
     859                   (setf (instruction-opcode instruction) 176
     860                         (instruction-args instruction) nil
     861                         changed t)))))))))
    861862    (values code changed)))
    862863
Note: See TracChangeset for help on using the changeset viewer.