From: Chris Hanson Date: Wed, 8 Aug 1990 00:58:42 +0000 (+0000) Subject: When the continuation parser makes a transition from interpreted to X-Git-Tag: 20090517-FFI~11274 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=0fe007834afbabcc5b6d8210fd6c03705ace77d6;p=mit-scheme.git When the continuation parser makes a transition from interpreted to compiled frames or vice-versa, the history subproblem must be stepped. The reasons for this are that: 1. When interpreted code is called from compiled code, a new history subproblem is pushed. This subproblem must be discarded when making the transition back to the compiled code stack frame. 2. When compiled code is called from interpreted code, the existing history subproblem is preserved for use if the compiled code tail-recurses back into interpreted code. This subproblem must be discarded when making the transition back to the interpreted code stack frame. --- diff --git a/v7/src/runtime/conpar.scm b/v7/src/runtime/conpar.scm index f57b6abbd..7c011c7b6 100644 --- a/v7/src/runtime/conpar.scm +++ b/v7/src/runtime/conpar.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/conpar.scm,v 14.15 1990/06/28 18:09:25 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/conpar.scm,v 14.16 1990/08/08 00:57:07 cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -209,7 +209,10 @@ MIT in each case. |# (parser-state/dynamic-state state) (parser-state/fluid-bindings state) (parser-state/interrupt-mask state) - (if history-subproblem? history undefined-history) + (if (and history-subproblem? + (stack-frame-type/subproblem? type)) + history + undefined-history) previous-history-offset previous-history-control-point (+ (vector-length elements) n-elements) @@ -461,7 +464,7 @@ MIT in each case. |# (set! stack-frame-type/return-to-interpreter (make-stack-frame-type false false - false + true 1 parser/standard-next)) (set! word-size @@ -517,11 +520,8 @@ MIT in each case. |# (standard-frame 'HALT 2) (standard-frame 'JOIN-STACKLETS 2) (standard-frame 'POP-RETURN-ERROR 2) - (standard-frame 'REENTER-COMPILED-CODE 2) (standard-frame 'RESTORE-VALUE 2) - (standard-frame 'COMPILER-INTERRUPT-RESTART 3) - (standard-frame 'COMPILER-LINK-CACHES-RESTART 8) - + (standard-subproblem 'IN-PACKAGE-CONTINUE 2) (standard-subproblem 'ACCESS-CONTINUE 2) (standard-subproblem 'PRIMITIVE-COMBINATION-1-APPLY 2) @@ -544,17 +544,6 @@ MIT in each case. |# (standard-subproblem 'REPEAT-DISPATCH 4) (standard-subproblem 'PRIMITIVE-COMBINATION-3-FIRST-OPERAND 4) (standard-subproblem 'PRIMITIVE-COMBINATION-3-APPLY 4) - (standard-subproblem 'COMPILER-REFERENCE-RESTART 4) - (standard-subproblem 'COMPILER-SAFE-REFERENCE-RESTART 4) - (standard-subproblem 'COMPILER-ACCESS-RESTART 4) - (standard-subproblem 'COMPILER-UNASSIGNED?-RESTART 4) - (standard-subproblem 'COMPILER-UNBOUND?-RESTART 4) - (standard-subproblem 'COMPILER-REFERENCE-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-SAFE-REFERENCE-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-UNASSIGNED?-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-ASSIGNMENT-RESTART 5) - (standard-subproblem 'COMPILER-DEFINITION-RESTART 5) - (standard-subproblem 'COMPILER-ASSIGNMENT-TRAP-RESTART 5) (standard-subproblem 'MOVE-TO-ADJACENT-POINT 6) (standard-subproblem 'COMBINATION-SAVE-VALUE length/combination-save-value) (standard-subproblem 'REPEAT-PRIMITIVE length/repeat-primitive) @@ -563,13 +552,35 @@ MIT in each case. |# (standard-subproblem 'COMBINATION-APPLY length) (standard-subproblem 'INTERNAL-APPLY length) (standard-subproblem 'INTERNAL-APPLY-VAL length)) + + (let ((compiler-frame + (lambda (name length) + (stack-frame-type name false true length parser/standard-next))) + (compiler-subproblem + (lambda (name length) + (stack-frame-type name true true length parser/standard-next)))) + + (let ((length (length/application-frame 4 0))) + (compiler-subproblem 'COMPILER-LOOKUP-APPLY-TRAP-RESTART length) + (compiler-subproblem 'COMPILER-OPERATOR-LOOKUP-TRAP-RESTART length)) + + (compiler-frame 'COMPILER-INTERRUPT-RESTART 3) (compiler-frame 'COMPILER-LINK-CACHES-RESTART 8) + (compiler-frame 'REENTER-COMPILED-CODE 2) + + (compiler-subproblem 'COMPILER-ACCESS-RESTART 4) + (compiler-subproblem 'COMPILER-ASSIGNMENT-RESTART 5) + (compiler-subproblem 'COMPILER-ASSIGNMENT-TRAP-RESTART 5) + (compiler-subproblem 'COMPILER-DEFINITION-RESTART 5) + (compiler-subproblem 'COMPILER-LOOKUP-APPLY-RESTART + (length/application-frame 4 1)) + (compiler-subproblem 'COMPILER-REFERENCE-RESTART 4) + (compiler-subproblem 'COMPILER-REFERENCE-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-SAFE-REFERENCE-RESTART 4) + (compiler-subproblem 'COMPILER-SAFE-REFERENCE-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-UNASSIGNED?-RESTART 4) + (compiler-subproblem 'COMPILER-UNASSIGNED?-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-UNBOUND?-RESTART 4)) - (standard-subproblem 'COMPILER-LOOKUP-APPLY-RESTART - (length/application-frame 4 1)) - - (let ((length (length/application-frame 4 0))) - (standard-subproblem 'COMPILER-LOOKUP-APPLY-TRAP-RESTART length) - (standard-subproblem 'COMPILER-OPERATOR-LOOKUP-TRAP-RESTART length)) (stack-frame-type 'HARDWARE-TRAP true false diff --git a/v7/src/runtime/histry.scm b/v7/src/runtime/histry.scm index 445498e6d..ae69efcea 100644 --- a/v7/src/runtime/histry.scm +++ b/v7/src/runtime/histry.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/histry.scm,v 14.2 1989/10/26 06:46:19 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/histry.scm,v 14.3 1990/08/08 00:58:12 cph Rel $ -Copyright (c) 1988, 1989 Massachusetts Institute of Technology +Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -212,7 +212,7 @@ MIT in each case. |# (loop (next-reduction current) step))))) (define (dummy-compiler-reduction? reduction) - (and (null? (reduction-expression reduction)) + (and (false? (reduction-expression reduction)) (eq? (ucode-return-address pop-from-compiled-code) (reduction-environment reduction)))) @@ -233,4 +233,5 @@ MIT in each case. |# (set! the-empty-history (cons (vector-ref (get-fixed-objects-vector) (fixed-objects-vector-slot 'DUMMY-HISTORY)) - '()))) \ No newline at end of file + '())) + unspecific) \ No newline at end of file diff --git a/v7/src/runtime/version.scm b/v7/src/runtime/version.scm index eba6a74bc..9441ab952 100644 --- a/v7/src/runtime/version.scm +++ b/v7/src/runtime/version.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.90 1990/07/20 01:24:13 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.91 1990/08/08 00:58:42 cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -45,7 +45,7 @@ MIT in each case. |# '())) (add-system! microcode-system) (add-event-receiver! event:after-restore snarf-microcode-version!) - (add-identification! "Runtime" 14 90)) + (add-identification! "Runtime" 14 91)) (define microcode-system) (define (snarf-microcode-version!) diff --git a/v8/src/runtime/conpar.scm b/v8/src/runtime/conpar.scm index a0ed15bac..fbc7d19d4 100644 --- a/v8/src/runtime/conpar.scm +++ b/v8/src/runtime/conpar.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/conpar.scm,v 14.15 1990/06/28 18:09:25 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/conpar.scm,v 14.16 1990/08/08 00:57:07 cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -209,7 +209,10 @@ MIT in each case. |# (parser-state/dynamic-state state) (parser-state/fluid-bindings state) (parser-state/interrupt-mask state) - (if history-subproblem? history undefined-history) + (if (and history-subproblem? + (stack-frame-type/subproblem? type)) + history + undefined-history) previous-history-offset previous-history-control-point (+ (vector-length elements) n-elements) @@ -461,7 +464,7 @@ MIT in each case. |# (set! stack-frame-type/return-to-interpreter (make-stack-frame-type false false - false + true 1 parser/standard-next)) (set! word-size @@ -517,11 +520,8 @@ MIT in each case. |# (standard-frame 'HALT 2) (standard-frame 'JOIN-STACKLETS 2) (standard-frame 'POP-RETURN-ERROR 2) - (standard-frame 'REENTER-COMPILED-CODE 2) (standard-frame 'RESTORE-VALUE 2) - (standard-frame 'COMPILER-INTERRUPT-RESTART 3) - (standard-frame 'COMPILER-LINK-CACHES-RESTART 8) - + (standard-subproblem 'IN-PACKAGE-CONTINUE 2) (standard-subproblem 'ACCESS-CONTINUE 2) (standard-subproblem 'PRIMITIVE-COMBINATION-1-APPLY 2) @@ -544,17 +544,6 @@ MIT in each case. |# (standard-subproblem 'REPEAT-DISPATCH 4) (standard-subproblem 'PRIMITIVE-COMBINATION-3-FIRST-OPERAND 4) (standard-subproblem 'PRIMITIVE-COMBINATION-3-APPLY 4) - (standard-subproblem 'COMPILER-REFERENCE-RESTART 4) - (standard-subproblem 'COMPILER-SAFE-REFERENCE-RESTART 4) - (standard-subproblem 'COMPILER-ACCESS-RESTART 4) - (standard-subproblem 'COMPILER-UNASSIGNED?-RESTART 4) - (standard-subproblem 'COMPILER-UNBOUND?-RESTART 4) - (standard-subproblem 'COMPILER-REFERENCE-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-SAFE-REFERENCE-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-UNASSIGNED?-TRAP-RESTART 4) - (standard-subproblem 'COMPILER-ASSIGNMENT-RESTART 5) - (standard-subproblem 'COMPILER-DEFINITION-RESTART 5) - (standard-subproblem 'COMPILER-ASSIGNMENT-TRAP-RESTART 5) (standard-subproblem 'MOVE-TO-ADJACENT-POINT 6) (standard-subproblem 'COMBINATION-SAVE-VALUE length/combination-save-value) (standard-subproblem 'REPEAT-PRIMITIVE length/repeat-primitive) @@ -563,13 +552,35 @@ MIT in each case. |# (standard-subproblem 'COMBINATION-APPLY length) (standard-subproblem 'INTERNAL-APPLY length) (standard-subproblem 'INTERNAL-APPLY-VAL length)) + + (let ((compiler-frame + (lambda (name length) + (stack-frame-type name false true length parser/standard-next))) + (compiler-subproblem + (lambda (name length) + (stack-frame-type name true true length parser/standard-next)))) + + (let ((length (length/application-frame 4 0))) + (compiler-subproblem 'COMPILER-LOOKUP-APPLY-TRAP-RESTART length) + (compiler-subproblem 'COMPILER-OPERATOR-LOOKUP-TRAP-RESTART length)) + + (compiler-frame 'COMPILER-INTERRUPT-RESTART 3) (compiler-frame 'COMPILER-LINK-CACHES-RESTART 8) + (compiler-frame 'REENTER-COMPILED-CODE 2) + + (compiler-subproblem 'COMPILER-ACCESS-RESTART 4) + (compiler-subproblem 'COMPILER-ASSIGNMENT-RESTART 5) + (compiler-subproblem 'COMPILER-ASSIGNMENT-TRAP-RESTART 5) + (compiler-subproblem 'COMPILER-DEFINITION-RESTART 5) + (compiler-subproblem 'COMPILER-LOOKUP-APPLY-RESTART + (length/application-frame 4 1)) + (compiler-subproblem 'COMPILER-REFERENCE-RESTART 4) + (compiler-subproblem 'COMPILER-REFERENCE-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-SAFE-REFERENCE-RESTART 4) + (compiler-subproblem 'COMPILER-SAFE-REFERENCE-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-UNASSIGNED?-RESTART 4) + (compiler-subproblem 'COMPILER-UNASSIGNED?-TRAP-RESTART 4) + (compiler-subproblem 'COMPILER-UNBOUND?-RESTART 4)) - (standard-subproblem 'COMPILER-LOOKUP-APPLY-RESTART - (length/application-frame 4 1)) - - (let ((length (length/application-frame 4 0))) - (standard-subproblem 'COMPILER-LOOKUP-APPLY-TRAP-RESTART length) - (standard-subproblem 'COMPILER-OPERATOR-LOOKUP-TRAP-RESTART length)) (stack-frame-type 'HARDWARE-TRAP true false