Change expansion of OR to use scode disjunction type. This produces
authorChris Hanson <org/chris-hanson/cph>
Fri, 14 Mar 2003 01:12:39 +0000 (01:12 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 14 Mar 2003 01:12:39 +0000 (01:12 +0000)
more efficient code, because the compiler recognizes it and behaves
specially.

v7/src/runtime/mit-syntax.scm
v7/src/runtime/syntax-output.scm

index 8660b61381143160affc0133c106b33e3b7193e1..5ef79fb6d5db08243ae957ec9c3ba99c807f7be4 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: mit-syntax.scm,v 14.17 2003/03/08 02:06:43 cph Exp $
+$Id: mit-syntax.scm,v 14.18 2003/03/14 01:11:36 cph Exp $
 
 Copyright 1989,1990,1991,2001,2002,2003 Massachusetts Institute of Technology
 
@@ -594,25 +594,22 @@ USA.
                     (car operands))))
             `#T))))))
 
-(define-er-macro-transformer 'OR system-global-environment
-  (lambda (form rename compare)
-    compare                            ;ignore
-    (capture-expansion-history
-     (lambda (history)
-       (syntax-check '(KEYWORD * EXPRESSION) form history)
-       (let ((operands (cdr form)))
-        (if (pair? operands)
-            (let ((let-keyword (rename 'LET))
-                  (if-keyword (rename 'IF))
-                  (temp (rename 'TEMP)))
-              (let loop ((operands operands))
-                (if (pair? (cdr operands))
-                    `(,let-keyword ((,temp ,(car operands)))
-                                   (,if-keyword ,temp
-                                                ,temp
-                                                ,(loop (cdr operands))))
-                    (car operands))))
-            `#F))))))
+(define-compiler 'OR system-global-environment
+  (lambda (form environment history)
+    (syntax-check '(KEYWORD * EXPRESSION) form history)
+    (if (pair? (cdr form))
+       (let loop ((expressions (cdr form)) (selector select-cdr))
+         (let ((compiled
+                (compile/subexpression (car expressions)
+                                       environment
+                                       history
+                                       (selector/add-car selector))))
+           (if (pair? (cdr expressions))
+               (output/disjunction compiled
+                                   (loop (cdr expressions)
+                                         (selector/add-cdr selector)))
+               compiled)))
+       `#F)))
 \f
 (define-er-macro-transformer 'CASE system-global-environment
   (lambda (form rename compare)
index 51f55adff46475c7cdf388cf2ac9de20efa0ada4..eba6592f1d1469872a3b4e566740c1b558f6327e 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: syntax-output.scm,v 14.9 2003/02/14 18:28:34 cph Exp $
+$Id: syntax-output.scm,v 14.10 2003/03/14 01:12:39 cph Exp $
 
 Copyright 1989,1990,1991,2001,2002,2003 Massachusetts Institute of Technology
 
@@ -59,6 +59,9 @@ USA.
 (define (output/conditional predicate consequent alternative)
   (make-conditional predicate consequent alternative))
 
+(define (output/disjunction predicate alternative)
+  (make-disjunction predicate alternative))
+
 (define (output/sequence expressions)
   (make-sequence expressions))