optimization: when doing primitive application, the result value can be directly placed if targetted to a lexical reference.

This commit is contained in:
Danny Yoo 2011-03-08 04:05:52 -05:00
parent 393e0707e1
commit 703edc46a0

View File

@ -384,10 +384,17 @@
cenv
(make-instruction-sequence
`(,(make-AssignPrimOpStatement
'val
;; optimization: we can put the result directly in the registers, or in
;; the appropriate spot on the stack.
(cond [(eq? target 'val)
'val]
[(eq? target 'proc)
'proc]
[(EnvLexicalReference? target)
(make-EnvLexicalReference (+ (EnvLexicalReference-depth target) n))])
(make-ApplyPrimitiveProcedure n))
,(make-PopEnvironment n 0)
,(make-AssignImmediateStatement target (make-Reg 'val)))))
,(make-PopEnvironment n 0))))
after-call))))