Previous: , Up: compiler recordize   [Index]


17.8.4 Introduction of debug calls

Whenever debugging mode is enabled, application forms like:

(?func ?arg ...)

are expanded and recordised into:

(funcall (primref debug-call)
         ?annotation
         ?rator ?rand ...)

where: ?rator is the recordised version of ?func; ?rand is the recordised version of ?arg; ?annotation is a debugging annotation:

(constant (?annotation-source . (?func ?arg ...)))

in which ?annotation-source has one of the formats:

#f
(?port-identifier . ?first-character-offset)

the introducion of debug-call is performed no matter what expression ?func is.

Example: lambda application

The standard language form:

((lambda (x) x) 1)

is expanded into the core language form:

(annotated-call ?annotation-struct
                (annotated-case-lambda #'(lambda (x) x)
                                       ((x x)))
                (quote 1))

which is recordised as:

(funcall (primref debug-call)
         (constant (?annotation-source . ((lambda (x) x) '1)))
         (lambda (x_0) x_0)
         (constant 1))

Example: let application

The standard language form:

((let ((f (lambda (y) y)))
   f)
  1)

is expanded and recordised into:

(funcall (primref debug-call)
         (constant (?annotation-source
                    . ((let ((f (lambda (x) x))) f) 1)))
         (bind ((f_0 (lambda (x_0) x_0))) f_0)
         (constant 1))