I think the output looks more correct.

This commit is contained in:
dyoo 2011-03-03 15:26:30 -05:00
parent 6ebef1c206
commit 30e9e82877

View File

@ -300,11 +300,13 @@
;; The last operand needs to be handled specially: it currently lives in ;; The last operand needs to be handled specially: it currently lives in
;; val. We move the procedure at env[n] over to proc, and move the ;; val. We move the procedure at env[n] over to proc, and move the
;; last operand at 'val into env[n]. ;; last operand at 'val into env[n].
(make-instruction-sequence (append-instruction-sequences
`(,(make-AssignImmediateStatement 'proc (car ops)
(make-EnvLexicalReference n)) (make-instruction-sequence
,(make-AssignImmediateStatement (make-EnvOffset n) `(,(make-AssignImmediateStatement 'proc
(make-Reg 'val))))] (make-EnvLexicalReference n))
,(make-AssignImmediateStatement (make-EnvOffset n)
(make-Reg 'val)))))]
[else [else
;; Otherwise, add instructions to juggle the operator and operands in the stack. ;; Otherwise, add instructions to juggle the operator and operands in the stack.
(append-instruction-sequences (car ops) (append-instruction-sequences (car ops)
@ -328,15 +330,18 @@
primitive-branch))) primitive-branch)))
compiled-branch compiled-branch
(compile-proc-appl cenv n target compiled-linkage) (end-with-application-linkage
compiled-linkage
cenv
(compile-proc-appl cenv n target compiled-linkage))
primitive-branch primitive-branch
(end-with-application-linkage linkage (end-with-linkage linkage
cenv cenv
(make-instruction-sequence (make-instruction-sequence
`(,(make-AssignPrimOpStatement `(,(make-AssignPrimOpStatement
target target
(make-ApplyPrimitiveProcedure n))))) (make-ApplyPrimitiveProcedure n)))))
after-call)))) after-call))))