summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-12-22 10:37:27 -0500
committerAndy Wingo <wingo@pobox.com>2014-01-11 16:01:11 +0100
commit4dfcb360068552a95280a7a91baea9f0354230db (patch)
treebb745cdcb3c80e28a0979d4f1c44440785384383
parent7ab76a830bfbc7fcd45ec4780ba661e0c61bacd6 (diff)
downloadguile-4dfcb360068552a95280a7a91baea9f0354230db.tar.gz
Only emit receive-values if it is needed
* module/language/cps/compile-bytecode.scm (compile-fun): Don't emit receive-values unless there is a minimum or maximum number of values.
-rw-r--r--module/language/cps/compile-bytecode.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/language/cps/compile-bytecode.scm b/module/language/cps/compile-bytecode.scm
index 84941894f..183998bb7 100644
--- a/module/language/cps/compile-bytecode.scm
+++ b/module/language/cps/compile-bytecode.scm
@@ -334,7 +334,8 @@
(emit-prompt asm (slot tag) escape? proc-slot receive-args)
(emit-br asm k)
(emit-label asm receive-args)
- (emit-receive-values asm proc-slot (->bool rest) nreq)
+ (unless (and rest (zero? nreq))
+ (emit-receive-values asm proc-slot (->bool rest) nreq))
(when (and rest
(match (vector-ref contv (cfa-k-idx cfa khandler-body))
(($ $kargs names (_ ... rest))
@@ -468,7 +469,8 @@
;; FIXME: Only allow more values if there is a rest arg.
;; Express values truncation by the presence of an
;; unused rest arg instead of implicitly.
- (emit-receive-values asm proc-slot #t nreq)
+ (unless (zero? nreq)
+ (emit-receive-values asm proc-slot #t nreq))
(when (and rest-var (maybe-slot rest-var))
(emit-bind-rest asm (+ proc-slot 1 nreq)))
(for-each (match-lambda