From 6d104812c65221fac1bfcd4d1c9e094156f24544 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 6 Mar 1991 01:01:23 +0000 Subject: [PATCH] Fix bug: RTL generation of return statement whose value is a constant 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. --- .../compiler/machines/bobcat/make.scm-68040 | 4 +- v7/src/compiler/machines/mips/make.scm-big | 4 +- v7/src/compiler/machines/mips/make.scm-little | 4 +- v7/src/compiler/machines/spectrum/make.scm | 4 +- v7/src/compiler/rtlgen/fndvar.scm | 49 ++++++++++++------- 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/v7/src/compiler/machines/bobcat/make.scm-68040 b/v7/src/compiler/machines/bobcat/make.scm-68040 index 9dec1d1b1..e2e54a92b 100644 --- a/v7/src/compiler/machines/bobcat/make.scm-68040 +++ b/v7/src/compiler/machines/bobcat/make.scm-68040 @@ -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 diff --git a/v7/src/compiler/machines/mips/make.scm-big b/v7/src/compiler/machines/mips/make.scm-big index d90a8520e..ab772256a 100644 --- a/v7/src/compiler/machines/mips/make.scm-big +++ b/v7/src/compiler/machines/mips/make.scm-big @@ -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 diff --git a/v7/src/compiler/machines/mips/make.scm-little b/v7/src/compiler/machines/mips/make.scm-little index 6a0347f67..78accd874 100644 --- a/v7/src/compiler/machines/mips/make.scm-little +++ b/v7/src/compiler/machines/mips/make.scm-little @@ -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 diff --git a/v7/src/compiler/machines/spectrum/make.scm b/v7/src/compiler/machines/spectrum/make.scm index 4727d42ef..537dd0881 100644 --- a/v7/src/compiler/machines/spectrum/make.scm +++ b/v7/src/compiler/machines/spectrum/make.scm @@ -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 diff --git a/v7/src/compiler/rtlgen/fndvar.scm b/v7/src/compiler/rtlgen/fndvar.scm index 077b92c17..008a938aa 100644 --- a/v7/src/compiler/rtlgen/fndvar.scm +++ b/v7/src/compiler/rtlgen/fndvar.scm @@ -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)))) + (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) -- 2.25.1