Thanks for the answer, Marc.
You wrote, 2022-01-04 09:14:
The dependency graph is computed after program transformations and (some) optimizations are performed. It could be the case that v4.9.4 is doing a better job at optimizing the code than v4.9.3 so that a procedure that was kept in the code by v4.9.3 has been eliminated by v4.9.4. It is hard to tell in your particular case which optimization is causing the issue.
Here’s a simple example:
$ cat dg.scm (declare (optimize-dead-definitions)) (declare (standard-bindings) (block) (inlining-limit 500))
(define (f x) (list x x))
(define (g x) (if x (f (list 1 x)) 42))
(define (h x) (list (f x) (g x)))
(pp (g #f)) $ gsc -c -expansion dg.scm Expansion:
(pp 42)
Impressive.
With v4.9.3 the expansion will include the definition of f, g and h even though none of those definitions are required by the code (due to procedure inlining).
Perhaps you could look at the difference in dependency graphs generated by v4.9.3 and v4.9.4 to find what is now considered dead that wasn’t in v4.9.3?
Too large, will try that with a smaller program.
This might point to an optimization you need to turn off to get the same result as v4.9.3 . The drop from 7178 to 6248 “reachable” procedures may simply be better inlining by the v4.9.4 compiler. Turning off inlining with a (declare (not inline)) may be all that is needed.
I am already using:
(declare (r5rs-scheme) (not constant-fold) (not inline) (optimize-dead-definitions) (standard-bindings) (extended-bindings))
Ciao Sven