Changeset 13463 for trunk/abcl/src/org


Ignore:
Timestamp:
08/11/11 17:05:46 (10 years ago)
Author:
ehuelsmann
Message:

Code generation efficiency: when the closure array is only
read from: don't copy it - ever.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r13449 r13463  
    21632163         (register (allocate-register nil)))
    21642164    (aload (compiland-closure-register compiland))        ;; src
    2165     (emit-push-constant-int 0)                            ;; srcPos
    2166     (emit-push-constant-int (length *closure-variables*))
    2167     (emit-anewarray +lisp-closure-binding+)             ;; dest
    2168     (emit 'dup)
    2169     (astore register)  ;; save dest value
    2170     (emit-push-constant-int 0)                            ;; destPos
    2171     (emit-push-constant-int (length *closure-variables*)) ;; length
    2172     (emit-invokestatic +java-system+ "arraycopy"
    2173                        (list +java-object+ :int
    2174                              +java-object+ :int :int) nil)
    2175     (aload register))) ;; reload dest value
     2165    (when (some #'(lambda (var)
     2166                    (< 1 (variable-writes var)))
     2167                *closure-variables*)
     2168      (emit-push-constant-int 0) ;; srcPos
     2169      (emit-push-constant-int (length *closure-variables*))
     2170      (emit-anewarray +lisp-closure-binding+) ;; dest
     2171      (emit 'dup)
     2172      (astore register)        ;; save dest value
     2173      (emit-push-constant-int 0)                          ;; destPos
     2174      (emit-push-constant-int (length *closure-variables*)) ;; length
     2175      (emit-invokestatic +java-system+ "arraycopy"
     2176                         (list +java-object+ :int
     2177                               +java-object+ :int :int) nil)
     2178      (aload register)))) ;; reload dest value
    21762179
    21772180
Note: See TracChangeset for help on using the changeset viewer.