trying to reduce a little allocation

This commit is contained in:
Danny Yoo 2012-02-16 17:09:32 -05:00
parent 7b31b119a5
commit a97e858b43
2 changed files with 24 additions and 14 deletions

View File

@ -17,19 +17,29 @@
"M.p.label"]
[(MakeCompiledProcedure? op)
(format "new RT.Closure(~a,~a,[~a],~a)"
(assemble-label (make-Label (MakeCompiledProcedure-label op))
blockht)
(assemble-arity (MakeCompiledProcedure-arity op))
(string-join (map
assemble-env-reference/closure-capture
;; The closure values are in reverse order
;; to make it easier to push, in bulk, into
;; the environment (which is also in reversed order)
;; during install-closure-values.
(reverse (MakeCompiledProcedure-closed-vals op)))
",")
(assemble-display-name (MakeCompiledProcedure-display-name op)))]
(cond
;; Small optimization: try to avoid creating the array if we know up front
;; that the closure has no closed values.
[(null? (MakeCompiledProcedure-closed-vals op))
(format "new RT.Closure(~a,~a,undefined,~a)"
(assemble-label (make-Label (MakeCompiledProcedure-label op))
blockht)
(assemble-arity (MakeCompiledProcedure-arity op))
(assemble-display-name (MakeCompiledProcedure-display-name op)))]
[else
(format "new RT.Closure(~a,~a,[~a],~a)"
(assemble-label (make-Label (MakeCompiledProcedure-label op))
blockht)
(assemble-arity (MakeCompiledProcedure-arity op))
(string-join (map
assemble-env-reference/closure-capture
;; The closure values are in reverse order
;; to make it easier to push, in bulk, into
;; the environment (which is also in reversed order)
;; during install-closure-values.
(reverse (MakeCompiledProcedure-closed-vals op)))
",")
(assemble-display-name (MakeCompiledProcedure-display-name op)))])]
[(MakeCompiledProcedureShell? op)
(format "new RT.Closure(~a,~a,undefined,~a)"

View File

@ -7,4 +7,4 @@
(provide version)
(: version String)
(define version "1.142")
(define version "1.143")