more refactoring
This commit is contained in:
parent
1f158490ac
commit
7e4ba67db5
33
compiler.rkt
33
compiler.rkt
|
@ -1445,9 +1445,8 @@
|
|||
|
||||
(: compile-with-cont-mark (WithContMark CompileTimeEnvironment Target Linkage -> InstructionSequence))
|
||||
(define (compile-with-cont-mark exp cenv target linkage)
|
||||
(cond
|
||||
[(or (ReturnLinkage/NonTail? linkage)
|
||||
(ReturnLinkage? linkage))
|
||||
(: in-return-context (-> InstructionSequence))
|
||||
(define (in-return-context)
|
||||
(append-instruction-sequences
|
||||
(compile (WithContMark-key exp) cenv 'val next-linkage-expects-single)
|
||||
(make-instruction-sequence `(,(make-AssignImmediateStatement
|
||||
|
@ -1456,12 +1455,14 @@
|
|||
(compile (WithContMark-value exp) cenv 'val next-linkage-expects-single)
|
||||
(make-instruction-sequence `(,(make-PerformStatement
|
||||
(make-InstallContinuationMarkEntry!))))
|
||||
(compile (WithContMark-body exp) cenv target linkage))]
|
||||
(compile (WithContMark-body exp) cenv target linkage)))
|
||||
|
||||
[(or (NextLinkage? linkage)
|
||||
(LabelLinkage? linkage)
|
||||
(NextLinkage/Expects? linkage)
|
||||
(LabelLinkage/Expects? linkage))
|
||||
(: in-other-context ((U NextLinkage
|
||||
LabelLinkage
|
||||
NextLinkage/Expects
|
||||
LabelLinkage/Expects)
|
||||
-> InstructionSequence))
|
||||
(define (in-other-context linkage)
|
||||
(let ([body-next-linkage (cond [(NextLinkage? linkage)
|
||||
next-linkage]
|
||||
[(LabelLinkage? linkage)
|
||||
|
@ -1486,7 +1487,21 @@
|
|||
(make-InstallContinuationMarkEntry!))))
|
||||
(compile (WithContMark-body exp) cenv target body-next-linkage)
|
||||
(make-instruction-sequence
|
||||
`(,(make-PopControlFrame))))))]))
|
||||
`(,(make-PopControlFrame)))))))
|
||||
|
||||
(cond
|
||||
[(ReturnLinkage/NonTail? linkage)
|
||||
(in-return-context)]
|
||||
[(ReturnLinkage? linkage)
|
||||
(in-return-context)]
|
||||
[(NextLinkage? linkage)
|
||||
(in-other-context linkage)]
|
||||
[(LabelLinkage? linkage)
|
||||
(in-other-context linkage)]
|
||||
[(NextLinkage/Expects? linkage)
|
||||
(in-other-context linkage)]
|
||||
[(LabelLinkage/Expects? linkage)
|
||||
(in-other-context linkage)]))
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user