renaming PushControlFrame to more specific PushControlFrame/Call, since control frames can be of several types

This commit is contained in:
Danny Yoo 2011-04-14 13:05:05 -04:00
parent d43f1100e3
commit 0c8cd9234c
5 changed files with 25 additions and 24 deletions

View File

@ -139,7 +139,7 @@ EOF
(next)]
[(PushImmediateOntoEnvironment? stmt)
(next)]
[(PushControlFrame? stmt)
[(PushControlFrame/Call? stmt)
(next)]
[(PushControlFrame/Prompt? stmt)
(next)]
@ -259,8 +259,8 @@ EOF
empty]
[(PushImmediateOntoEnvironment? stmt)
(collect-input (PushImmediateOntoEnvironment-value stmt))]
[(PushControlFrame? stmt)
(label->labels (PushControlFrame-label stmt))]
[(PushControlFrame/Call? stmt)
(label->labels (PushControlFrame/Call-label stmt))]
[(PushControlFrame/Prompt? stmt)
(label->labels (PushControlFrame/Prompt-label stmt))]
[(PopControlFrame? stmt)
@ -330,9 +330,9 @@ EOF
[(GotoStatement? stmt)
(assemble-jump (GotoStatement-target stmt))]
[(PushControlFrame? stmt)
[(PushControlFrame/Call? stmt)
(format "MACHINE.control.push(new RUNTIME.CallFrame(~a, MACHINE.proc));"
(let ([label (PushControlFrame-label stmt)])
(let ([label (PushControlFrame/Call-label stmt)])
(cond
[(symbol? label) label]
[(LinkedLabel? label) (LinkedLabel-label label)])))]

View File

@ -968,7 +968,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -985,7 +985,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -1006,7 +1006,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -1023,7 +1023,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -1044,7 +1044,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -1063,7 +1063,7 @@
proc-return-multiple)])
(append-instruction-sequences
(make-instruction-sequence
`(,(make-PushControlFrame proc-return)))
`(,(make-PushControlFrame/Call proc-return)))
maybe-install-jump-address
(make-instruction-sequence
`(,(make-GotoStatement entry-point-target)))
@ -1297,7 +1297,7 @@
;; FIXME: create separate frame structure here, and don't try to reuse.
(make-instruction-sequence
`(,(make-AssignImmediateStatement 'proc (make-Const #f))
,(make-PushControlFrame after-body)))
,(make-PushControlFrame/Call after-body)))
;(make-instruction-sequence
; `(,(make-AssignImmediateStatement 'proc (make-Const #f))

View File

@ -80,7 +80,7 @@
PushImmediateOntoEnvironment
PushControlFrame
PushControlFrame/Call
PushControlFrame/Prompt
PopControlFrame))
@ -123,10 +123,11 @@
(define-struct: PopControlFrame ()
#:transparent)
;; Adding a frame for getting back after procedure application.
;; The 'proc register must hold either #f or a closure at the time of
;; this call, as the control frame will hold onto the called procedure record.
(define-struct: PushControlFrame ([label : (U Symbol LinkedLabel)])
(define-struct: PushControlFrame/Call ([label : (U Symbol LinkedLabel)])
#:transparent)
(define-struct: PushControlFrame/Prompt ([tag : (U OpArg DefaultContinuationPromptTag)]

View File

@ -109,7 +109,7 @@
(step-push-environment! m i)]
[(PushImmediateOntoEnvironment? i)
(step-push-immediate-onto-environment! m i)]
[(PushControlFrame? i)
[(PushControlFrame/Call? i)
(step-push-control-frame! m i)]
[(PushControlFrame/Prompt? i)
(step-push-control-frame/prompt! m i)]
@ -168,9 +168,9 @@
(step-push-environment! m (make-PushEnvironment 1 (PushImmediateOntoEnvironment-box? stmt)))
((get-target-updater t) m v)))
(: step-push-control-frame! (machine PushControlFrame -> 'ok))
(: step-push-control-frame! (machine PushControlFrame/Call -> 'ok))
(define (step-push-control-frame! m stmt)
(control-push! m (make-CallFrame (PushControlFrame-label stmt)
(control-push! m (make-CallFrame (PushControlFrame/Call-label stmt)
(ensure-closure-or-false (machine-proc m))
(make-hasheq)
(make-hasheq))))

View File

@ -167,9 +167,9 @@
;; PushControl
(let ([m (new-machine `(,(make-AssignImmediateStatement 'proc (make-Const #f))
foo
,(make-PushControlFrame 'foo)
,(make-PushControlFrame/Call 'foo)
bar
,(make-PushControlFrame 'bar)
,(make-PushControlFrame/Call 'bar)
baz
))])
(test (machine-control (run! m))
@ -181,9 +181,9 @@
;; PopControl
(let ([m (new-machine `(,(make-AssignImmediateStatement 'proc (make-Const #f))
foo
,(make-PushControlFrame 'foo)
,(make-PushControlFrame/Call 'foo)
bar
,(make-PushControlFrame 'bar)
,(make-PushControlFrame/Call 'bar)
baz
,(make-PopControlFrame)
))])
@ -192,9 +192,9 @@
(let ([m (new-machine `(,(make-AssignImmediateStatement 'proc (make-Const #f))
foo
,(make-PushControlFrame 'foo)
,(make-PushControlFrame/Call 'foo)
bar
,(make-PushControlFrame 'bar)
,(make-PushControlFrame/Call 'bar)
baz
,(make-PopControlFrame)
,(make-PopControlFrame)))])
@ -488,7 +488,7 @@
;; GetControlStackLabel
(let ([m (new-machine `(,(make-AssignImmediateStatement 'proc (make-Const #f))
foo
,(make-PushControlFrame 'foo)
,(make-PushControlFrame/Call 'foo)
,(make-AssignPrimOpStatement 'proc (make-GetControlStackLabel))))])
(test (machine-proc (run! m))
'foo))