Fix bug: RTL generation of return statement whose value is a constant
authorChris Hanson <org/chris-hanson/cph>
Wed, 6 Mar 1991 01:01:23 +0000 (01:01 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 6 Mar 1991 01:01:23 +0000 (01:01 +0000)
or a trivially-closed procedure was incorrect.  Part of the code
generation assumed that the value would be used directly, while
another part assumed that it would be stored in a register and then
the register would be referenced.  Now both parts agree that the value
is used directly in this case.

v7/src/compiler/machines/bobcat/make.scm-68040
v7/src/compiler/machines/mips/make.scm-big
v7/src/compiler/machines/mips/make.scm-little
v7/src/compiler/machines/spectrum/make.scm
v7/src/compiler/rtlgen/fndvar.scm

index 9dec1d1b13469316a435707e41940a119a5750a2..e2e54a92ba938b011e04c9cb9e4b577ed87f4612 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/make.scm-68040,v 4.79 1991/02/15 18:15:32 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/make.scm-68040,v 4.80 1991/03/06 00:58:11 cph Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -41,4 +41,4 @@ MIT in each case. |#
            ((package/reference (find-package name) 'INITIALIZE-PACKAGE!)))
          '((COMPILER MACROS)
            (COMPILER DECLARATIONS)))
-(add-system! (make-system "Liar (Motorola MC68020)" 4 79 '()))
\ No newline at end of file
+(add-system! (make-system "Liar (Motorola MC68020)" 4 80 '()))
\ No newline at end of file
index d90a8520ec0f97e0d7dbad4e4ebcdd85283f30a8..ab772256a8c33e27cbe4b3b17525fe734bf46b85 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-big,v 4.79 1991/02/15 18:16:32 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-big,v 4.80 1991/03/06 00:59:19 cph Exp $
 $MC68020-Header: make.scm,v 4.73 90/05/03 15:17:24 GMT jinx Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
@@ -42,4 +42,4 @@ MIT in each case. |#
            ((package/reference (find-package name) 'INITIALIZE-PACKAGE!)))
          '((COMPILER MACROS)
            (COMPILER DECLARATIONS)))
-(add-system! (make-system "Liar (MIPS)" 4 79 '()))
\ No newline at end of file
+(add-system! (make-system "Liar (MIPS)" 4 80 '()))
\ No newline at end of file
index 6a0347f672e8dadeb82fa9f631a88d54eae29a51..78accd8740347251965c00c675c1552c8aa30421 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-little,v 4.79 1991/02/15 18:16:32 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/mips/make.scm-little,v 4.80 1991/03/06 00:59:19 cph Exp $
 $MC68020-Header: make.scm,v 4.73 90/05/03 15:17:24 GMT jinx Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
@@ -42,4 +42,4 @@ MIT in each case. |#
            ((package/reference (find-package name) 'INITIALIZE-PACKAGE!)))
          '((COMPILER MACROS)
            (COMPILER DECLARATIONS)))
-(add-system! (make-system "Liar (MIPS)" 4 79 '()))
\ No newline at end of file
+(add-system! (make-system "Liar (MIPS)" 4 80 '()))
\ No newline at end of file
index 4727d42ef0a86753bb8481d3369f388599697d69..537dd0881648c47d7b6a6fe18cb94cd78a9b3cf1 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/spectrum/make.scm,v 4.79 1991/02/15 18:17:14 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/spectrum/make.scm,v 4.80 1991/03/06 01:01:23 cph Exp $
 $MC68020-Header: make.scm,v 4.76 90/08/21 02:20:43 GMT jinx Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
@@ -42,4 +42,4 @@ MIT in each case. |#
            ((package/reference (find-package name) 'INITIALIZE-PACKAGE!)))
          '((COMPILER MACROS)
            (COMPILER DECLARATIONS)))
-(add-system! (make-system "Liar (HP PA)" 4 79 '()))
\ No newline at end of file
+(add-system! (make-system "Liar (HP PA)" 4 80 '()))
\ No newline at end of file
index 077b92c17c917faf06da72e538c3aa84a50b460f..008a938aa8a53a99fee0cd3354785a8c4e3d105a 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/fndvar.scm,v 1.5 1990/05/03 15:11:40 jinx Rel $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/fndvar.scm,v 1.6 1991/03/06 00:57:47 cph Exp $
 
-Copyright (c) 1988, 1990 Massachusetts Institute of Technology
+Copyright (c) 1988-91 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -66,30 +66,43 @@ MIT in each case. |#
       variable                         ; ignored
       (rtl:make-fetch locative))
     (lambda (variable block locative)
-      block locative
+      block locative                   ; ignored
       (error "Closure variable in IC frame" variable))))
 
 (define (find-stack-overwrite-variable context variable)
   (find-variable-no-tricks context variable
     (lambda (variable locative)
-      variable
+      variable                         ; ignored
       locative)
     (lambda (variable block locative)
-      block locative
-      (error "Stack overwrite slot in IC frame" variable))))      
-
+      block locative                   ; ignored
+      (error "Stack overwrite slot in IC frame" variable))))
+\f
 (define (find-variable get-value? context variable if-compiler if-ic if-cached)
-  (let ((if-locative
-        (if get-value?
-            (lambda (locative)
-              (if-compiler (rtl:make-fetch locative)))
-            if-compiler)))
-    (if (variable/value-variable? variable)
-       (if-locative
-        (let ((continuation (reference-context/procedure context)))
-          (if (continuation/ever-known-operator? continuation)
-              (continuation/register continuation)
-              register:value)))
+  (if (variable/value-variable? variable)
+      (begin
+       (if (not get-value?)
+           (error "Can't take locative of value variable" variable))
+       (if-compiler
+        (if (lvalue-integrated? variable)
+            (let ((rvalue (lvalue-known-value variable)))
+              (cond ((rvalue/constant? rvalue)
+                     (rtl:make-constant (constant-value rvalue)))
+                    ((and (rvalue/procedure? rvalue)
+                          (procedure/trivial-or-virtual? rvalue))
+                     (make-trivial-closure-cons rvalue))
+                    (else
+                     (error "illegal integrated value variable" variable))))
+            (rtl:make-fetch
+             (let ((continuation (reference-context/procedure context)))
+               (if (continuation/ever-known-operator? continuation)
+                   (continuation/register continuation)
+                   register:value))))))
+      (let ((if-locative
+            (if get-value?
+                (lambda (locative)
+                  (if-compiler (rtl:make-fetch locative)))
+                if-compiler)))
        (find-variable-internal context variable
          (and get-value? if-compiler)
          (lambda (variable locative)