Re: (trace (labels ...)) in some cases

Raymond Toy <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
>>>>> "mr" == Martin Rydstr|m <[email protected]> writes:

    mr> Hi,
    mr> I looked a little at the trace machinery announced for 19d, and
    mr> I've run into some cases where it doesn't seem to work.

    mr> ;; Doesn't work
    mr> (defun zot1 (x) 
    mr>   (labels ((zat (y z) 
    mr>              (if (zerop y) z (zat (1- y) (1+ z))))) 
    mr>     (declare (notinline zot1))
    mr>     (zat x 0)))

    mr> ;; Doesn't work
    mr> (defun zot2 (x) 
    mr>   (labels ((zat (y z) 
    mr>              (if (zerop y) z (zat (1- y) (1+ z))))) 
    mr>     (+ x (zat x 0))))

    mr> ;; Works
    mr> (defun zot3 (x) 
    mr>   (labels ((zat (y z) 
    mr>              (if (zerop y) z (zat (1- y) (1+ z))))) 
    mr>     (= (zat x 0) (zat x 0))))


Thanks for the report.  I think the common theme here is that in zot1
and zot2 the zat is called in only one place and has been inlined.  In
zot3, zat is not inlined.

Unfortunately, I don't know how to detect and/or fix that.  Well, we
can obviously detect it since we get an error when trying to trace
those functions.

Ray
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.