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

Christophe Rhodes csr21 at cantab.net
Sun Feb 12 13:58:29 UTC 2012


Dan Corkill <corkill at GBBopen.org> writes:

> (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))))

Here's a related test case:

  (defun %show-issue (instance)
    (when (typep 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)))))
  (%show-issue (make-instance 'foo))

I don't know whether that passes or fails on CMUCL, but it does reveal
a too-optimistic inlining (or maybe constraint propagation) on SBCL --
so it might be worth checking.

Best,

Christophe


More information about the cmucl-help mailing list