summaryrefslogtreecommitdiff
path: root/module/language/cps.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2014-04-02 15:48:13 +0200
committerAndy Wingo <wingo@pobox.com>2014-04-02 15:48:13 +0200
commit408da790153b2c9620df5169e976e05d3647b995 (patch)
tree45c0c40dd7d8b14d5ce4f4077e82dd57bf1ae356 /module/language/cps.scm
parentce1dbe8c1bc3f1d37978d2ca1d5949b03514a5e3 (diff)
downloadguile-408da790153b2c9620df5169e976e05d3647b995.tar.gz
compute-max-label-and-var takes letrec vars into account.
* module/language/cps.scm (compute-max-label-and-var): Fix to take letrec vars into account.
Diffstat (limited to 'module/language/cps.scm')
-rw-r--r--module/language/cps.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/module/language/cps.scm b/module/language/cps.scm
index c1bb30478..90f38a4ca 100644
--- a/module/language/cps.scm
+++ b/module/language/cps.scm
@@ -508,8 +508,13 @@
(lambda (label cont max-label max-var)
(values (max label max-label)
(match cont
- (($ $kargs names vars)
- (fold max max-var vars))
+ (($ $kargs names vars body)
+ (let lp ((body body) (max-var (fold max max-var vars)))
+ (match body
+ (($ $letk conts body) (lp body max-var))
+ (($ $letrec names vars funs body)
+ (lp body (fold max max-var vars)))
+ (_ max-var))))
(($ $kentry self)
(max self max-var))
(_ max-var))))