When counting the operands of a combination, do not include operands
authorChris Hanson <org/chris-hanson/cph>
Sat, 13 Jun 1987 00:14:10 +0000 (00:14 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 13 Jun 1987 00:14:10 +0000 (00:14 +0000)
which do not push any values.  This means that `length' is not
adequate for computing the number of operands.  Instead use the new
procedure `count-operands'.

v7/src/compiler/rtlgen/rgcomb.scm

index ba7ff983b9887eb6732c00f269e8f2b99f3b2c75..770e1d7fcc4f914ac6e6e2c5ae5097758acc75b6 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rgcomb.scm,v 1.24 1987/06/12 21:51:10 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rgcomb.scm,v 1.25 1987/06/13 00:14:10 cph Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -369,7 +369,7 @@ MIT in each case. |#
 \f
 (define (make-call push-operator? combination operator operands generator)
   (let ((callee (combination-known-operator combination))
-       (n-operands (length operands))
+       (n-operands (count-operands operands))
        (finish
         (lambda (frame-size)
           (scfg-append!
@@ -408,6 +408,16 @@ MIT in each case. |#
                          (loop (-1+ n))))))
             (finish n-parameters)))
        (finish n-operands))))
+
+(define (count-operands operands)
+  (cond ((null? operands)
+        0)
+       ((transmit-values (car operands)
+          (lambda (cfg prefix expression)
+            expression))
+        (1+ (count-operands (cdr operands))))
+       (else
+        (count-operands (cdr operands)))))
 \f
 ;;;; Prefixes