optimization: when doing primitive application, the result value can be directly placed if targetted to a lexical reference.
This commit is contained in:
parent
393e0707e1
commit
703edc46a0
13
compile.rkt
13
compile.rkt
|
@ -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))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user