(define-package (scode-optimizer integrate)
(files "subst")
(parent (scode-optimizer))
+ (export ()
+ sf:display-top-level-procedure-names?)
(export (scode-optimizer)
integrate/top-level
integrate/get-top-level-block
(simulate-unknown-application environment procedure)
procedure)))
+;;; If not #f, display the top-level procedure names as they are
+;;; processed. Useful for debugging.
+(define sf:display-top-level-procedure-names? #f)
+
+(define (maybe-display-name name)
+ (if (and sf:display-top-level-procedure-names?
+ (null? *current-block-names*))
+ (begin
+ (newline)
+ (display ";; ")
+ (display name))))
+
;; Cannot optimize (lambda () (bar)) => bar (eta substitution) because
;; BAR may be a procedure with different arity than the lambda
\f
(define (integrate/procedure operations environment procedure)
(let ((block (procedure/block procedure))
+ (name (procedure/name procedure))
(required (procedure/required procedure))
(optional (procedure/optional procedure))
(rest (procedure/rest procedure)))
- (fluid-let ((*current-block-names*
- (cons (procedure/name procedure)
- *current-block-names*)))
+ (maybe-display-name name)
+ (fluid-let ((*current-block-names* (cons name *current-block-names*)))
(process-block-flags (block/flags block)
(lambda ()
(let ((body
(combination/operator body)
(procedure/make (procedure/scode procedure)
block
- (procedure/name procedure)
+ name
required
optional
rest