Changeset 11652


Ignore:
Timestamp:
02/10/09 07:10:23 (14 years ago)
Author:
ehuelsmann
Message:

Check cast takes a class name as its argument, not a class reference.

Found by: Robert Dodier.

File:
1 edited

Legend:

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

    r11651 r11652  
    20702070   (cond ((null (symbol-package symbol))
    20712071    (setf g (if *compile-file-truename*
    2072           (declare-object-as-string symbol +lisp-symbol+)
    2073           (declare-object symbol +lisp-symbol+))))
     2072          (declare-object-as-string symbol +lisp-symbol+
     2073                                                +lisp-symbol-class+)
     2074          (declare-object symbol +lisp-symbol+
     2075                                      +lisp-symbol-class+))))
    20742076   (t
    20752077    (let ((*code* *static-code*)
     
    22682270
    22692271(defknown declare-object-as-string (t &optional t) string)
    2270 (defun declare-object-as-string (obj &optional (obj-class +lisp-object+))
     2272(defun declare-object-as-string (obj &optional (obj-ref +lisp-object+)
     2273                                     obj-class)
    22712274  (let* ((g (symbol-name (gensym "OBJSTR")))
    22722275         (s (with-output-to-string (stream) (dump-form obj stream)))
    22732276         (*code* *static-code*))
    2274     (declare-field g obj-class)
     2277    (declare-field g obj-ref)
    22752278    (emit 'ldc (pool-string s))
    22762279    (emit-invokestatic +lisp-class+ "readObjectFromString"
    22772280                       (list +java-string+) +lisp-object+)
    2278     (when (string/= obj-class +lisp-object+)
     2281    (when (and obj-class (string/= obj-class +lisp-object+))
    22792282      (emit 'checkcast obj-class))
    2280     (emit 'putstatic *this-class* g obj-class)
     2283    (emit 'putstatic *this-class* g obj-ref)
    22812284    (setf *static-code* *code*)
    22822285    g))
     
    23292332
    23302333(declaim (ftype (function (t &optional t) string) declare-object))
    2331 (defun declare-object (obj &optional (obj-class +lisp-object+))
     2334(defun declare-object (obj &optional (obj-ref +lisp-object+)
     2335                           obj-class)
    23322336  (let ((key (symbol-name (gensym "OBJ"))))
    23332337    (remember key obj)
     
    23362340      (let* (
    23372341           (*code* *static-code*))
    2338       (declare-field g2 obj-class)
     2342      (declare-field g2 obj-ref)
    23392343      (emit 'getstatic *this-class* g1 +lisp-simple-string+)
    23402344      (emit-invokestatic +lisp-class+ "recall"
    23412345                         (list +lisp-simple-string+) +lisp-object+)
    2342       (when (string/= obj-class +lisp-object+)
     2346      (when (and obj-class (string/= obj-class +lisp-object-class+))
    23432347        (emit 'checkcast obj-class))
    2344       (emit 'putstatic *this-class* g2 obj-class)
     2348      (emit 'putstatic *this-class* g2 obj-ref)
    23452349      (setf *static-code* *code*)
    23462350      g2))))
Note: See TracChangeset for help on using the changeset viewer.