Changeset 11855
- Timestamp:
- 05/11/09 20:32:22 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11854 r11855 8031 8031 (*this-class* (class-file-class class-file)) 8032 8032 (args (cadr p1-result)) 8033 (closure-args (intersection *closure-variables* 8034 (compiland-arg-vars compiland))) 8033 8035 (body (cddr p1-result)) 8034 8036 (*using-arg-array* nil) 8035 8037 (*hairy-arglist-p* nil) 8038 ;; *hairy-arglist-p* != NIL --> *using-arglist-array* != NIL 8036 8039 8037 8040 (*child-p* (not (null (compiland-parent compiland)))) … … 8069 8072 (compiland-closure-register compiland))) 8070 8073 8071 8072 (let ((register *register*) 8073 (index 0)) 8074 (when *using-arg-array* 8075 (setf (compiland-argument-register compiland) (allocate-register))) 8076 8077 ;; Assign indices or registers, depending on where the args are 8078 ;; located: the arg-array or the call-stack 8079 (let ((index 0)) 8074 8080 (dolist (variable (compiland-arg-vars compiland)) 8075 8081 (aver (null (variable-register variable))) 8076 8082 (aver (null (variable-index variable))) 8077 (cond 8078 (*hairy-arglist-p* 8079 (setf (variable-index variable) index)) 8080 (*using-arg-array* 8081 (setf (variable-index variable) index)) 8082 (t 8083 (setf (variable-register variable) register))) 8084 (incf register) 8083 (if *using-arg-array* 8084 (setf (variable-index variable) index) 8085 (setf (variable-register variable) (allocate-register))) 8085 8086 (incf index))) 8086 8087 8087 (cond (*using-arg-array* 8088 ;; One slot for arg array. 8089 (setf (compiland-argument-register compiland) (allocate-register)) 8090 8091 (unless (or *closure-variables* *child-p*) 8092 ;; Reserve a register for each parameter. 8093 (dolist (variable (compiland-arg-vars compiland)) 8094 (aver (null (variable-register variable))) 8095 (aver (null (variable-reserved-register variable))) 8096 (unless (variable-special-p variable) 8097 (setf (variable-reserved-register variable) 8098 (allocate-register)))))) 8099 (t 8100 ;; Otherwise, one register for each argument. 8101 (dolist (variable (compiland-arg-vars compiland)) 8102 (declare (ignore variable)) 8103 (allocate-register)))) 8088 (when (and *using-arg-array* 8089 (not (or *closure-variables* *child-p*))) 8090 ;; Reserve a register for each parameter. 8091 (dolist (variable (compiland-arg-vars compiland)) 8092 (aver (null (variable-register variable))) 8093 (aver (null (variable-reserved-register variable))) 8094 (unless (variable-special-p variable) 8095 (setf (variable-reserved-register variable) 8096 (allocate-register))))) 8104 8097 8105 8098 (p2-compiland-process-type-declarations body) … … 8120 8113 (cond (*child-p* 8121 8114 (aver (eql (compiland-closure-register compiland) 1)) 8122 (when (some #'variable-closure-index 8123 (compiland-arg-vars compiland)) 8115 (when closure-args 8124 8116 (aload (compiland-closure-register compiland)))) 8125 8117 (t … … 8127 8119 (dformat t "p2-compiland ~S anewarray 1~%" (compiland-name compiland)) 8128 8120 (emit 'anewarray "org/armedbear/lisp/LispObject"))) 8129 (dolist (variable (compiland-arg-vars compiland))8121 (dolist (variable closure-args) 8130 8122 (dformat t "considering ~S ...~%" (variable-name variable)) 8131 (when (variable-closure-index variable) 8132 (dformat t "moving variable ~S~%" (variable-name variable)) 8133 (cond ((variable-register variable) 8134 (when (eql (variable-register variable) 8135 (compiland-closure-register compiland)) 8136 (error "ERROR! compiland closure register = ~S var ~S register = ~S~%" 8137 (compiland-closure-register compiland) 8138 (variable-name variable) 8139 (variable-register variable))) 8140 (emit 'dup) ; array 8141 (emit-push-constant-int (variable-closure-index variable)) 8142 (aload (variable-register variable)) 8143 (emit 'aastore) 8144 (setf (variable-register variable) nil)) ; The variable has moved. 8145 ((variable-index variable) 8146 (emit 'dup) ; array 8147 (emit-push-constant-int (variable-closure-index variable)) 8148 (aload (compiland-argument-register compiland)) 8149 (emit-push-constant-int (variable-index variable)) 8150 (emit 'aaload) 8151 (emit 'aastore) 8152 (setf (variable-index variable) nil))))) ; The variable has moved. 8123 (dformat t "moving variable ~S~%" (variable-name variable)) 8124 (cond ((variable-register variable) 8125 (when (eql (variable-register variable) 8126 (compiland-closure-register compiland)) 8127 (error "ERROR! compiland closure register = ~S var ~S register = ~S~%" 8128 (compiland-closure-register compiland) 8129 (variable-name variable) 8130 (variable-register variable))) 8131 (emit 'dup) ; array 8132 (emit-push-constant-int (variable-closure-index variable)) 8133 (aload (variable-register variable)) 8134 (emit 'aastore) 8135 (setf (variable-register variable) nil)) 8136 ;; The variable has moved. 8137 ((variable-index variable) 8138 (emit 'dup) ; array 8139 (emit-push-constant-int (variable-closure-index variable)) 8140 (aload (compiland-argument-register compiland)) 8141 (emit-push-constant-int (variable-index variable)) 8142 (emit 'aaload) 8143 (emit 'aastore) 8144 (setf (variable-index variable) nil)))) 8145 ;; The variable has moved. 8146 8153 8147 (aver (not (null (compiland-closure-register compiland)))) 8154 8148 (cond (*child-p* 8155 (when (some #'variable-closure-index 8156 (compiland-arg-vars compiland)) 8149 (when closure-args 8157 8150 (emit 'pop))) 8158 8151 (t
Note: See TracChangeset
for help on using the changeset viewer.