Changeset 11640


Ignore:
Timestamp:
02/08/09 08:48:58 (13 years ago)
Author:
ehuelsmann
Message:

Type derivation for multi-argument +/-/*;
Fixed type-arguments for DERIVE-TYPE-MIN, DERIVE-TYPE-MAX;
Generation of inline code for multi-argument #'*.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11638 r11640  
    11711171                 135 ; i2d
    11721172                 136 ; l2i
     1173                 137 ; l2f
     1174                 138 ; l2d
    11731175                 141 ; f2d
    11741176                 144 ; d2f
     
    63106312(defknown derive-type-minus (t) t)
    63116313(defun derive-type-minus (form)
    6312   (let ((args (cdr form))
    6313         (result-type t))
     6314  (let ((op (car form))
     6315        (args (cdr form)))
    63146316    (case (length args)
    6315       (1
    6316        (setf result-type
    6317              (derive-type-numeric-op (car form)
    6318                                      zero-integer-type
    6319                                      (derive-compiler-type (%car args)))))
    6320       (2
    6321        (setf result-type
    6322              (derive-type-numeric-op (car form)
    6323                                      (derive-compiler-type (car args))
    6324                                      (derive-compiler-type (cadr args))))))
    6325     result-type))
     6317      (1 (derive-type-numeric-op (car form)
     6318                                 zero-integer-type
     6319                                 (derive-compiler-type (%car args))))
     6320      (2 (flet ((combine (x y)
     6321                  (derive-type-numeric-op op x y)))
     6322           (reduce #'combine (cdr args) :key #'derive-compiler-type
     6323                   :initial-value (derive-compiler-type (car args))))))))
    63266324
    63276325
     
    63326330(defknown derive-type-plus (t) t)
    63336331(defun derive-type-plus (form)
    6334   (let ((args (cdr form))
    6335         (result-type t))
    6336     (when (= (length args) 2)
    6337       (setf result-type
    6338             (derive-type-numeric-op (car form)
    6339                                     (derive-compiler-type (car args))
    6340                                     (derive-compiler-type (cadr args)))))
    6341     result-type))
     6332  (let ((op (car form))
     6333        (args (cdr form)))
     6334    (flet ((combine (x y)
     6335             (derive-type-numeric-op op x y)))
     6336      (reduce #'combine (cdr args) :key #'derive-compiler-type
     6337              :initial-value (derive-compiler-type (car args))))))
    63426338
    63436339(define-int-bounds-derivation * (low1 high1 low2 high2)
     
    63576353
    63586354(defun derive-type-times (form)
    6359   (let ((args (cdr form))
    6360         (result-type t))
    6361     (when (= (length args) 2)
    6362       (setf result-type
    6363             (derive-type-numeric-op (car form)
    6364                                     (derive-compiler-type (car args))
    6365                                     (derive-compiler-type (cadr args)))))
    6366   result-type))
     6355  (let ((op (car form))
     6356        (args (cdr form)))
     6357    (flet ((combine (x y)
     6358             (derive-type-numeric-op op x y)))
     6359      (reduce #'combine (cdr args) :key #'derive-compiler-type
     6360              :initial-value (derive-compiler-type (car args))))))
    63676361
    63686362(declaim (ftype (function (t) t) derive-type-max))
     
    63726366    (flet ((combine (x y)
    63736367             (derive-type-numeric-op op x y)))
    6374       (reduce #'combine (cdr args)
    6375               :initial-value (car args)))))
     6368      (reduce #'combine (cdr args) :key #'derive-compiler-type
     6369              :initial-value (derive-compiler-type (car args))))))
    63766370
    63776371(defknown derive-type-min (t) t)
     
    63816375    (flet ((combine (x y)
    63826376             (derive-type-numeric-op op x y)))
    6383       (reduce #'combine (cdr args)
    6384               :initial-value (car args)))))
     6377      (reduce #'combine (cdr args) :key #'derive-compiler-type
     6378              :initial-value (derive-compiler-type (car args))))))
    63856379
    63866380;; read-char &optional input-stream eof-error-p eof-value recursive-p => char
     
    67066700(defun p2-times (form target representation)
    67076701  (case (length form)
     6702    (2 (compile-form (cadr form) target representation))
    67086703    (3
    67096704     (let* ((args (cdr form))
     
    67486743    (t
    67496744     (dformat t "p2-times case 5~%")
    6750      (compile-function-call form target representation))))
     6745     (p2-times `(,(car form) (,(car form) ,(second form) ,(third form))
     6746                    ,@(nthcdr 3 form)) target representation))))
    67516747
    67526748(defknown p2-min/max (t t t) t)
Note: See TracChangeset for help on using the changeset viewer.