hacked out something for with-continuation-mark; I don't think it's quite right yet. I need a separate frame structure here; I don't like how I'm overloading callframes.
This commit is contained in:
parent
d959ecf9ae
commit
75fd4a9005
67
compiler.rkt
67
compiler.rkt
|
@ -1271,7 +1271,7 @@
|
|||
(: compile-with-cont-mark (WithContMark CompileTimeEnvironment Target Linkage -> InstructionSequence))
|
||||
(define (compile-with-cont-mark exp cenv target linkage)
|
||||
(cond
|
||||
[(ReturnLinkage? linkage)
|
||||
[(or (PromptLinkage? linkage) (ReturnLinkage? linkage))
|
||||
(append-instruction-sequences
|
||||
(compile (WithContMark-key exp) cenv 'val next-linkage)
|
||||
(make-instruction-sequence `(,(make-AssignImmediateStatement
|
||||
|
@ -1283,49 +1283,50 @@
|
|||
(compile (WithContMark-body exp) cenv target linkage))]
|
||||
|
||||
[(or (NextLinkage? linkage)
|
||||
(PromptLinkage? linkage)
|
||||
(LabelLinkage? linkage))
|
||||
(let* ([after-key-multiple (make-label 'afterKeyMultiple)]
|
||||
[after-key (make-LinkedLabel (make-label 'afterKey) after-key-multiple)]
|
||||
[after-value-multiple (make-label 'afterValueMultiple)]
|
||||
[after-value (make-LinkedLabel (make-label 'afterValue) after-value-multiple)]
|
||||
(let* (;[after-key-multiple (make-label 'afterKeyMultiple)]
|
||||
;[after-key (make-LinkedLabel (make-label 'afterKey) after-key-multiple)]
|
||||
;[after-value-multiple (make-label 'afterValueMultiple)]
|
||||
;[after-value (make-LinkedLabel (make-label 'afterValue) after-value-multiple)]
|
||||
[after-body-multiple (make-label 'afterBody)]
|
||||
[after-body (make-LinkedLabel (make-label 'afterBody) after-body-multiple)])
|
||||
(end-with-linkage
|
||||
linkage cenv
|
||||
(append-instruction-sequences
|
||||
(make-instruction-sequence
|
||||
`(,(make-AssignImmediateStatement 'proc (make-Const #f))
|
||||
,(make-PushControlFrame after-key)))
|
||||
(compile (WithContMark-key exp) cenv 'val prompt-linkage)
|
||||
after-key-multiple
|
||||
;; Fixme: we should error out here instead
|
||||
(make-instruction-sequence
|
||||
`(,(make-PopEnvironment (make-Reg 'argcount) (make-Const 0))))
|
||||
after-key
|
||||
(make-instruction-sequence `(,(make-AssignImmediateStatement
|
||||
(make-ControlFrameTemporary 'pendingContinuationMarkKey)
|
||||
(make-Reg 'val))))
|
||||
(make-instruction-sequence
|
||||
`(,(make-AssignImmediateStatement 'proc (make-Const #f))
|
||||
,(make-PushControlFrame after-value)))
|
||||
(compile (WithContMark-value exp) cenv 'val prompt-linkage)
|
||||
after-value-multiple
|
||||
;; Fixme: we should error out here instead
|
||||
(make-instruction-sequence
|
||||
`(,(make-PopEnvironment (make-Reg 'argcount) (make-Const 0))))
|
||||
after-value
|
||||
(make-instruction-sequence `(,(make-PerformStatement
|
||||
(make-InstallContinuationMarkEntry!))))
|
||||
;; Making a continuation frame; isn't really used for anything else but recording the key/value data.
|
||||
;; 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)))
|
||||
(compile (WithContMark-body exp) cenv target prompt-linkage)
|
||||
after-body-multiple
|
||||
|
||||
;(make-instruction-sequence
|
||||
; `(,(make-AssignImmediateStatement 'proc (make-Const #f))
|
||||
; ,(make-PushControlFrame after-key)))
|
||||
(compile (WithContMark-key exp) cenv 'val next-linkage)
|
||||
;after-key-multiple
|
||||
;; Fixme: we should error out here instead
|
||||
;(make-instruction-sequence
|
||||
; `(,(make-PopEnvironment (make-Reg 'argcount) (make-Const 0))))
|
||||
;after-key
|
||||
(make-instruction-sequence `(,(make-AssignImmediateStatement
|
||||
(make-ControlFrameTemporary 'pendingContinuationMarkKey)
|
||||
(make-Reg 'val))))
|
||||
;(make-instruction-sequence
|
||||
; `(,(make-AssignImmediateStatement 'proc (make-Const #f))
|
||||
; ,(make-PushControlFrame after-value)))
|
||||
(compile (WithContMark-value exp) cenv 'val next-linkage)
|
||||
;after-value-multiple
|
||||
;; Fixme: we should error out here instead
|
||||
;(make-instruction-sequence
|
||||
; `(,(make-PopEnvironment (make-Reg 'argcount) (make-Const 0))))
|
||||
;after-value
|
||||
(make-instruction-sequence `(,(make-PerformStatement
|
||||
(make-InstallContinuationMarkEntry!))))
|
||||
(compile (WithContMark-body exp) cenv target next-linkage)
|
||||
after-body-multiple
|
||||
after-body
|
||||
(make-instruction-sequence
|
||||
`(,(make-PopEnvironment (make-Reg 'argcount) (make-Const 0))))
|
||||
after-body)))]))
|
||||
`(,(make-PopControlFrame))))))]))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1123,7 +1123,7 @@
|
|||
|
||||
|
||||
;; Hmm... something is failing here.
|
||||
#;(test '(begin (define (extract-current-continuation-marks key)
|
||||
(test '(begin (define (extract-current-continuation-marks key)
|
||||
(continuation-mark-set->list
|
||||
(current-continuation-marks)
|
||||
key))
|
||||
|
|
Loading…
Reference in New Issue
Block a user