STEP macro does not work in Clozure CL

I want to use the step function to see how it went to the expected output, but it does not work.

Like this simple example:

(STEP (IF (ODDP 3) 'YES 'NO))

but nothing happens.

Is there some kind of optimization that makes me not see the trace steps ???

How to disable it?

Thanks!

+3
source share
4 answers

I do not think Clozure CL supports stepping. IIRC no one has funded this feature yet. This will require some work, as Clozure CL does not have an interpreter (where stepping can be maintained relatively painless).

Other implementations support stepping.

+2
source

STEP is not supported in CCL.

Solution for TRACE:

When a FOO function with a global name is defined using DEFUN, the compiler is allowed to assume that the function references to this function name refer to the function being defined (unless they are lexically shaded); it can thus skip the implicit SYMBOL-FUNCTION ("call everything that is in the FOO function cell") during self-service (calling FOO from FOO.) This saves one or two instructions for these calls, but (since then, TRACE has been working by changing what SYMBOL-FUNCTION returns) that cannot be tracked.

However, the compiler cannot do this (it cannot even assume that something defined by DEFUN will not be redefined later) if the function name is declared NOTINLINE at the self-starting point:

Example:

 ? (defun fact (x acc) (declare (notinline fact)) (if (= x 0) acc (fact (- x 1) (* x acc)))) ? (trace fact) NIL ? (fact 3 1) 0> Calling (FACT 3 1) 1> Calling (FACT 2 3) 2> Calling (FACT 1 6) 3> Calling (FACT 0 6) <3 FACT returned 6 <2 FACT returned 6 <1 FACT returned 6 <0 FACT returned 6 ? (step (fact 3 1)) 0> Calling (FACT 3 1) 1> Calling (FACT 2 3) 2> Calling (FACT 1 6) 3> Calling (FACT 0 6) <3 FACT returned 6 <2 FACT returned 6 <1 FACT returned 6 <0 FACT returned 6 

To tell the compiler, "as a matter of politics, I would prefer the ability to track functions that are called themselves and are defined using DEFUN and do not care about saving several loops for self-determination, a call."

from: DebugWithOpenMCL

or Rate the following form:

 (DECLAIM (OPTIMIZE (DEBUG 3))) 

before defining any function that needs to be traced.

+2
source

This is because CL: STEP is not implemented in CCL, because I implemented com.informatimago.common-lisp.lisp.stepper. You can get it using the quick list. The documentation is at https://gitorious.org/com-informatimago/com-informatimago/source/2b53ae44e8fa4d040fafcf4d93976500a8e464dc:common-lisp/lisp/stepper-packages.lisp#L146

+2
source

use cl-stepper: step instead of cl-user: step, because Clozure CL does not support it. if you have already installed quicklisp, try installing it: like this.

 (ql:quickload "com.informatimago.common-lisp.lisp.stepper") (defpackage :test (:use :cl-stepper)) (in-package :test) (def bar (hoge) ;; define some function ) (step (bar 3)) 
0
source

Source: https://habr.com/ru/post/1495651/


All Articles