minor: optimizing the splice a little more for code generation

This commit is contained in:
Danny Yoo 2012-02-27 14:39:40 -05:00
parent b1a09f3e9d
commit 40b616e9ea

View File

@ -588,10 +588,19 @@ EOF
(format "M.e.length-=~a;"
(assemble-oparg (PopEnvironment-n stmt) blockht))])]
[else
(format "M.e.splice(M.e.length-(~a+~a),~a);"
(assemble-oparg (PopEnvironment-skip stmt) blockht)
(assemble-oparg (PopEnvironment-n stmt) blockht)
(assemble-oparg (PopEnvironment-n stmt) blockht))]))]
(define skip (PopEnvironment-skip stmt))
(define n (PopEnvironment-n stmt))
(cond
[(and (Const? skip) (Const? n))
(format "M.e.splice(M.e.length-~a,~a);"
(+ (ensure-natural (Const-const skip))
(ensure-natural (Const-const n)))
(Const-const n))]
[else
(format "M.e.splice(M.e.length-(~a+~a),~a);"
(assemble-oparg skip blockht)
(assemble-oparg n blockht)
(assemble-oparg n blockht))])]))]
[(PushImmediateOntoEnvironment? stmt)
(format "M.e.push(~a);"