Changeset 11580


Ignore:
Timestamp:
01/24/09 11:04:17 (13 years ago)
Author:
ehuelsmann
Message:

Commit some of the changes required for FLOAT and DOUBLE support (clean up my wc a bit)

  • Add debugging output before triggering an ASSERT or AVER.
  • Add boxing/unboxing routines (for future use).
  • Add a new type (also for future use).
File:
1 edited

Legend:

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

    r11578 r11580  
    223223(defconstant +lisp-cons-class+ "org/armedbear/lisp/Cons")
    224224(defconstant +lisp-cons+ "Lorg/armedbear/lisp/Cons;")
     225(defconstant +lisp-integer-class+ "org/armedbear/lisp/LispInteger")
     226(defconstant +lisp-integer+ "Lorg/armedbear/lisp/LispInteger;")
    225227(defconstant +lisp-fixnum-class+ "org/armedbear/lisp/Fixnum")
    226228(defconstant +lisp-fixnum+ "Lorg/armedbear/lisp/Fixnum;")
     
    736738         (emit 'getfield +lisp-character-class+ "value" "C"))))
    737739
     740(defknown emit-unbox-long () t)
     741(defun emit-unbox-long ()
     742  (emit-invokestatic +lisp-bignum-class+ "longValue"
     743                     (lisp-object-arg-types 1) "J"))
     744
     745(defknown emit-unbox-float () t)
     746(defun emit-unbox-float ()
     747  (declare (optimize speed))
     748  (cond ((= *safety* 3)
     749         (emit-invokestatic +lisp-single-float-class+ "getValue"
     750                            (lisp-object-arg-types 1) "F"))
     751        (t
     752         (emit 'checkcast +lisp-single-float-class+)
     753         (emit 'getfield +lisp-single-float-class+ "value" "F"))))
     754
     755(defknown emit-unbox-double () t)
     756(defun emit-unbox-double ()
     757  (declare (optimize speed))
     758  (cond ((= *safety* 3)
     759         (emit-invokestatic +lisp-double-float-class+ "getValue"
     760                            (lisp-object-arg-types 1) "D"))
     761        (t
     762         (emit 'checkcast +lisp-double-float-class+)
     763         (emit 'getfield +lisp-double-float-class+ "value" "D"))))
     764
    738765(defknown emit-unbox-boolean () t)
    739766(defun emit-unbox-boolean ()
     
    771798         (emit-invokevirtual +lisp-object-class+ "doubleValue" nil "D"))
    772799        (t (assert nil))))
     800
     801(defknown emit-box-int () t)
     802(defun emit-box-int ()
     803  (declare (optimize speed))
     804  (new-fixnum)
     805  (emit 'dup_x1)
     806  (emit-fixnum-init nil))
    773807
    774808(defknown emit-box-long () t)
     
    835869          target))
    836870        (t
     871         (sys::%format t "emit-move-from-stack general case~%")
    837872         (aver nil))))
    838873
     
    22422277            (return-from compile-constant))
    22432278           (t
     2279            (sys::%format t "compile-constant int representation~%")
    22442280            (assert nil))))
    22452281    (:long
     
    22642300            (return-from compile-constant))
    22652301           (t
     2302            (sys::%format t "compile-constant long representation~%")
    22662303            (assert nil))))
    22672304    (:char
     
    22712308            (return-from compile-constant))
    22722309           (t
     2310            (sys::%format t "compile-constant :char representation~%")
    22732311            (assert nil))))
    22742312    (:boolean
     
    22932331            (emit 'ldc2_w (pool-double form))
    22942332            (emit 'd2f))
    2295            (t (assert nil)))
     2333           (t
     2334            (sys::%format t "compile-constant :float representation~%")
     2335            (assert nil)))
    22962336     (emit-move-from-stack target representation)
    22972337     (return-from compile-constant))
     
    23132353           ((typep form 'double-float)
    23142354            (emit 'ldc2_w (pool-double form)))
    2315            (t (assert nil)))
     2355           (t
     2356            (sys::%format t "compile-constant :double representation~%")
     2357            (assert nil)))
    23162358     (emit-move-from-stack target representation)
    23172359     (return-from compile-constant)))
     
    25412583        (if variable
    25422584            (emit 'iload (variable-register variable))
    2543             (aver nil)))))
     2585            (progn
     2586              (sys::%format t "emit-push-int~%")
     2587              (aver nil))))))
    25442588
    25452589(declaim (ftype (function (t) t) emit-push-long))
     
    39413985         (emit 'aastore))
    39423986        (t
     3987         (sys::%format t "compile-binding~%")
    39433988         (aver nil))))
    39443989
     
    64586503       (emit 'iconst_1))
    64596504      (:char
     6505       (sys::%format t "p2-length: :char case~%")
    64606506       (aver nil))
    64616507      (t
     
    74557501                    (emit 'iload (variable-register variable)))
    74567502                   (:char
     7503                    (sys::%format t "compile-var-ref :char case~%")
    74577504                    (aver nil))
    74587505                   (:long
     
    74877534                    (emit 'l2i))
    74887535                   (:char
     7536                    (sys::%format t "compile-var-ref :char case 2~%")
    74897537                    (aver nil))
    74907538                   (:long
     
    75247572                 (emit-move-from-stack target representation))
    75257573                (t
     7574                 (sys::%format t "compile-var-ref general case~%")
    75267575                 (aver nil)))))))
    75277576
Note: See TracChangeset for help on using the changeset viewer.