From 545b111118a45ad14e958256029632312a0e3d9d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 15 Feb 1991 16:52:44 +0000 Subject: [PATCH] Continuations that are closed in IC environments save their closing environment on the stack. The next-continuation-offset must account for that environment; previously it wasn't. --- v7/src/compiler/rtlgen/rtlgen.scm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/v7/src/compiler/rtlgen/rtlgen.scm b/v7/src/compiler/rtlgen/rtlgen.scm index ab60bab63..f7f37bbdd 100644 --- a/v7/src/compiler/rtlgen/rtlgen.scm +++ b/v7/src/compiler/rtlgen/rtlgen.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rtlgen.scm,v 4.23 1990/08/21 02:24:33 jinx Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rtlgen.scm,v 4.24 1991/02/15 16:52:44 cph Exp $ -Copyright (c) 1988, 1989 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 @@ -166,7 +166,7 @@ MIT in each case. |# rgraph label entry-edge - (block/next-continuation-offset + (compute-next-continuation-offset (continuation/closing-block continuation) (continuation/offset continuation)) (continuation/debugging-info continuation)))))) @@ -184,7 +184,7 @@ MIT in each case. |# (let ((obj (constant-value op))) (and (primitive-procedure? obj) (special-primitive-handler obj))))) - + (define (wrap-with-continuation-entry context scfg) (with-values (lambda () (generate-continuation-entry context)) (lambda (label setup cleanup) @@ -204,12 +204,17 @@ MIT in each case. |# *current-rgraph* label (cfg-entry-edge cleanup) - (block/next-continuation-offset + (compute-next-continuation-offset closing-block (reference-context/offset context)) (generated-dbg-continuation context label)) *extra-continuations*)) (values label setup cleanup)))) + +(define (compute-next-continuation-offset block offset) + (let ((nco (block/next-continuation-offset block offset))) + (and nco + (+ (continuation-extra-length block) nco)))) (define (block/next-continuation-offset block offset) (if (stack-block? block) @@ -235,6 +240,15 @@ MIT in each case. |# (define (generate/continuation-entry/pop-extra continuation) (pop-continuation-extra (continuation/closing-block continuation))) +(define (continuation-extra-length closing-block) + (cond ((ic-block? closing-block) + 1) + ((and (stack-block? closing-block) + (stack-block/dynamic-link? closing-block)) + 1) + (else + 0))) + (define (push-continuation-extra closing-block) (cond ((ic-block? closing-block) (rtl:make-push (rtl:make-fetch register:environment))) -- 2.25.1