adding more of the singular checks

This commit is contained in:
Danny Yoo 2011-04-17 14:31:42 -04:00
parent 97ace1e517
commit 832df0a2be

View File

@ -303,14 +303,16 @@
(ToplevelSet-pos exp))])
(let ([get-value-code
(compile (ToplevelSet-value exp) cenv lexical-pos
next-linkage-expects-single)])
next-linkage-expects-single)]
[singular-context-check (compile-singular-context-check linkage)])
(end-with-linkage
linkage
cenv
(append-instruction-sequences
get-value-code
(make-instruction-sequence
`(,(make-AssignImmediateStatement target (make-Const (void))))))))))
`(,(make-AssignImmediateStatement target (make-Const (void)))))
singular-context-check)))))
(: compile-branch (Branch CompileTimeEnvironment Target Linkage -> InstructionSequence))
@ -399,9 +401,11 @@
;; The lambda will close over the free variables.
;; Assumption: all of the lambda bodies have already been written out at the top, in -compile.
(define (compile-lambda exp cenv target linkage)
(let ([singular-context-check (compile-singular-context-check linkage)])
(end-with-linkage
linkage
cenv
(append-instruction-sequences
(make-instruction-sequence
`(,(make-AssignPrimOpStatement
target
@ -410,16 +414,19 @@
(make-ArityAtLeast (Lam-num-parameters exp))
(Lam-num-parameters exp))
(Lam-closure-map exp)
(Lam-name exp)))))))
(Lam-name exp)))))
singular-context-check))))
(: compile-lambda-shell (Lam CompileTimeEnvironment Target Linkage -> InstructionSequence))
;; Write out code for lambda expressions, minus the closure map.
;; Assumption: all of the lambda bodies have already been written out at the top, in -compile.
(define (compile-lambda-shell exp cenv target linkage)
(let ([singular-context-check (compile-singular-context-check linkage)])
(end-with-linkage
linkage
cenv
(append-instruction-sequences
(make-instruction-sequence
`(,(make-AssignPrimOpStatement
target
@ -427,7 +434,8 @@
(if (Lam-rest? exp)
(make-ArityAtLeast (Lam-num-parameters exp))
(Lam-num-parameters exp))
(Lam-name exp)))))))
(Lam-name exp)))))
singular-context-check))))
(: compile-lambda-body (Lam CompileTimeEnvironment -> InstructionSequence))