On Sun 06 Mar 2011 23:27, l...@gnu.org (Ludovic Courtès) writes: > I’ve pushed a variant of this patch.
Sorry for the delay in responding. There was actually a more general fix. I pushed the following on top of your patch: commit df1297956211b7353155c9b54d7e9c22d05ce493 Author: Andy Wingo <wi...@pobox.com> Date: Wed Mar 9 22:37:53 2011 +0100 fix-letrec tweaks * module/language/tree-il/fix-letrec.scm (partition-vars): Previously, for letrec* we treated all unreferenced vars as complex, because of orderings of effects that could arise in their definitions. But we can actually keep simple and lambda vars as unreferenced, as their initializers cannot cause side effects. (fix-letrec!): Remove letrec* -> letrec code, as it's unneeded. diff --git a/module/language/tree-il/fix-letrec.scm b/module/language/tree-il/fix-letrec.scm index ee8beb2..3d7db27 100644 --- a/module/language/tree-il/fix-letrec.scm +++ b/module/language/tree-il/fix-letrec.scm @@ -96,9 +96,10 @@ (s '()) (l '()) (c '())) (cond ((null? gensyms) - ;; Unreferenced vars are still complex for letrec*. - ;; We need to update our algorithm to "Fixing letrec - ;; reloaded" to fix this. + ;; Unreferenced complex vars are still + ;; complex for letrec*. We need to update + ;; our algorithm to "Fixing letrec reloaded" + ;; to fix this. (values (if in-order? (lset-difference eq? unref c) unref) @@ -109,7 +110,11 @@ (append c complex))) ((memq (car gensyms) unref) ;; See above note about unref and letrec*. - (if in-order? + (if (and in-order? + (not (lambda? (car vals))) + (not (simple-expression? + (car vals) orig-gensyms + effect+exception-free-primitive?))) (lp (cdr gensyms) (cdr vals) s l (cons (car gensyms) c)) (lp (cdr gensyms) (cdr vals) -- http://wingolog.org/