[cmucl-help] Inlined TYPEP over-optimization issue with CHANGE-CLASS

Dan Corkill corkill at GBBopen.org
Sun Feb 12 12:57:28 UTC 2012


Raymond Toy wrote:

> I placed your code in a file and compiled and loaded it with the 2012-02
> snapshot.  I get
> 
> CL-USER> (show-bug (make-instance 'foo))
> ;; Inlined TYPEP: NIL (incorrect)
> ;; Not-inlined TYPEP: NIL (correct)
> 
> What version exactly are you using and how did you run your example to
> get an incorrect result?

Ray,

With the 2012-02 snapshot, I also only see the issue with the DEFMETHOD
version.  Here is the newest test code that I ran:

(in-package :cl-user)

(defclass foo () ())
(defclass bar () ())

(defmethod no-issue ((instance foo))
  (%show-issue instance))
  
(defun %show-issue (instance)
  (change-class instance 'bar)
  (format t "~&;; Inlined TYPEP: ~s (~:*~:[correct~;incorrect~])~
             ~%;; Not-inlined TYPEP: ~s (~:*~:[correct~;incorrect~])~%"
          (typep instance 'foo)
          (locally (declare (notinline typep))
            (typep instance 'foo))))

(defmethod show-issue ((instance foo))
  (change-class instance 'bar)
  (format t "~&;; Inlined TYPEP: ~s (~:*~:[correct~;incorrect~])~
             ~%;; Not-inlined TYPEP: ~s (~:*~:[correct~;incorrect~])~%"
          (typep instance 'foo)
          (locally (declare (notinline typep))
            (typep instance 'foo))))

(format t "~&;;; No issue:~%")
(no-issue (make-instance 'foo))
(format t "~2&;;; Issue:~%")
(show-issue (make-instance 'foo))

I'll leave it the maintainers to decide whether or not the DEFMETHOD version
needs attention.  SBCL, Clozure CL, Lispworks, and Franz Allegro handle
both versions, while CMUCL and ECL exhibit the no-issue/show-issue difference.







More information about the cmucl-help mailing list