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

View File

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