Changeset 11861
- Timestamp:
- 05/14/09 18:17:08 (14 years ago)
- Location:
- branches/closure-fixes/abcl/src/org/armedbear/lisp
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/closure-fixes/abcl/src/org/armedbear/lisp/ClosureTemplateFunction.java
r11711 r11861 38 38 { 39 39 40 public LispObject[] ctx;40 public ClosureBinding[] ctx; 41 41 42 42 public ClosureTemplateFunction(LispObject lambdaList) … … 46 46 } 47 47 48 final public ClosureTemplateFunction setContext( LispObject[] context)48 final public ClosureTemplateFunction setContext(ClosureBinding[] context) 49 49 { 50 50 ctx = context; … … 157 157 158 158 // Zero args. 159 public LispObject _execute( LispObject[] context) throws ConditionThrowable159 public LispObject _execute(ClosureBinding[] context) throws ConditionThrowable 160 160 { 161 161 LispObject[] args = new LispObject[0]; … … 164 164 165 165 // One arg. 166 public LispObject _execute( LispObject[] context, LispObject first)166 public LispObject _execute(ClosureBinding[] context, LispObject first) 167 167 throws ConditionThrowable 168 168 { … … 173 173 174 174 // Two args. 175 public LispObject _execute( LispObject[] context, LispObject first,175 public LispObject _execute(ClosureBinding[] context, LispObject first, 176 176 LispObject second) 177 177 throws ConditionThrowable … … 184 184 185 185 // Three args. 186 public LispObject _execute( LispObject[] context, LispObject first,186 public LispObject _execute(ClosureBinding[] context, LispObject first, 187 187 LispObject second, LispObject third) 188 188 throws ConditionThrowable … … 196 196 197 197 // Four args. 198 public LispObject _execute( LispObject[] context, LispObject first,198 public LispObject _execute(ClosureBinding[] context, LispObject first, 199 199 LispObject second, LispObject third, 200 200 LispObject fourth) … … 210 210 211 211 // Five args. 212 public LispObject _execute( LispObject[] context, LispObject first,212 public LispObject _execute(ClosureBinding[] context, LispObject first, 213 213 LispObject second, LispObject third, 214 214 LispObject fourth, LispObject fifth) … … 225 225 226 226 // Six args. 227 public LispObject _execute( LispObject[] context, LispObject first,227 public LispObject _execute(ClosureBinding[] context, LispObject first, 228 228 LispObject second, LispObject third, 229 229 LispObject fourth, LispObject fifth, … … 242 242 243 243 // Seven args. 244 public LispObject _execute( LispObject[] context, LispObject first,244 public LispObject _execute(ClosureBinding[] context, LispObject first, 245 245 LispObject second, LispObject third, 246 246 LispObject fourth, LispObject fifth, … … 260 260 261 261 // Eight args. 262 public LispObject _execute( LispObject[] context, LispObject first,262 public LispObject _execute(ClosureBinding[] context, LispObject first, 263 263 LispObject second, LispObject third, 264 264 LispObject fourth, LispObject fifth, … … 280 280 281 281 // Arg array. 282 public LispObject _execute( LispObject[] context, LispObject[] args)282 public LispObject _execute(ClosureBinding[] context, LispObject[] args) 283 283 throws ConditionThrowable 284 284 { -
branches/closure-fixes/abcl/src/org/armedbear/lisp/CompiledClosure.java
r11514 r11861 37 37 { 38 38 private final ClosureTemplateFunction ctf; 39 private final LispObject[] context;39 private final ClosureBinding[] context; 40 40 41 public CompiledClosure(ClosureTemplateFunction ctf, LispObject[] context)41 public CompiledClosure(ClosureTemplateFunction ctf, ClosureBinding[] context) 42 42 { 43 43 super(ctf.getLambdaName(), ctf.getLambdaList()); -
branches/closure-fixes/abcl/src/org/armedbear/lisp/Lisp.java
r11777 r11861 1187 1187 1188 1188 public static final LispObject makeCompiledClosure(LispObject template, 1189 LispObject[] context)1189 ClosureBinding[] context) 1190 1190 throws ConditionThrowable 1191 1191 { -
branches/closure-fixes/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11857 r11861 206 206 (defconstant +lisp-object+ "Lorg/armedbear/lisp/LispObject;") 207 207 (defconstant +lisp-object-array+ "[Lorg/armedbear/lisp/LispObject;") 208 (defconstant +closure-binding-array+ "[Lorg/armedbear/lisp/ClosureBinding;") 208 209 (defconstant +lisp-symbol-class+ "org/armedbear/lisp/Symbol") 209 210 (defconstant +lisp-symbol+ "Lorg/armedbear/lisp/Symbol;") … … 3048 3049 (aload (compiland-closure-register compiland)) 3049 3050 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 3050 (list +lisp-object+ + lisp-object-array+)3051 (list +lisp-object+ +closure-binding-array+) 3051 3052 +lisp-object+))))) 3052 3053 (process-args args) … … 3920 3921 (list +lisp-symbol+ +lisp-object+) nil)) 3921 3922 ((variable-closure-index variable) 3923 (emit 'new "org/armedbear/lisp/ClosureBinding") 3924 (emit 'dup) 3925 (emit-invokespecial-init "org/armedbear/lisp/ClosureBinding" 3926 (list +lisp-object+)) 3922 3927 (aload (compiland-closure-register *current-compiland*)) 3923 3928 (emit 'swap) ; array value … … 4196 4201 ((variable-closure-index variable) 4197 4202 (aload (compiland-closure-register *current-compiland*)) 4203 (emit-push-constant-int (variable-closure-index variable)) 4204 (emit 'aaload) 4198 4205 (emit-swap representation nil) 4199 (emit-push-constant-int (variable-closure-index variable)) 4200 (emit-swap representation :int) 4201 (emit-array-store (variable-representation variable))) 4206 (emit 'putfield "org/armedbear/lisp/ClosureBinding" "value" 4207 "Lorg/armedbear/lisp/LispObject;")) 4202 4208 (t 4203 4209 ;;###FIXME: We might want to address the "temp-register" case too. … … 4205 4211 4206 4212 (defun emit-push-variable (variable) 4207 (flet ((emit-array- store(representation)4213 (flet ((emit-array-load (representation) 4208 4214 (emit (ecase representation 4209 4215 ((:int :boolean :char) … … 4225 4231 (aload (compiland-argument-register *current-compiland*)) 4226 4232 (emit-push-constant-int (variable-index variable)) 4227 (emit-array- store(variable-representation variable)))4233 (emit-array-load (variable-representation variable))) 4228 4234 ((variable-closure-index variable) 4229 4235 (aload (compiland-closure-register *current-compiland*)) 4230 4236 (emit-push-constant-int (variable-closure-index variable)) 4231 (emit-array-store (variable-representation variable))) 4237 (emit 'aaload) 4238 (emit 'getfield "org/armedbear/lisp/ClosureBinding" "value" 4239 "Lorg/armedbear/lisp/LispObject;")) 4232 4240 (t ;;###FIXME: We might want to address the "temp-register" case too. 4233 4241 (assert nil))))) … … 4870 4878 (aload (compiland-closure-register parent)) 4871 4879 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 4872 (list +lisp-object+ + lisp-object-array+)4880 (list +lisp-object+ +closure-binding-array+) 4873 4881 +lisp-object+))) 4874 4882 (emit-move-to-variable (local-function-variable local-function))) … … 5018 5026 (aload (compiland-closure-register *current-compiland*)) 5019 5027 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 5020 (list +lisp-object+ + lisp-object-array+)5028 (list +lisp-object+ +closure-binding-array+) 5021 5029 +lisp-object+) 5022 5030 (emit 'checkcast +lisp-compiled-closure-class+)) ; Stack: compiled-closure … … 5050 5058 (aload (compiland-closure-register *current-compiland*)) 5051 5059 (emit-invokestatic +lisp-class+ "makeCompiledClosure" 5052 (list +lisp-object+ + lisp-object-array+)5060 (list +lisp-object+ +closure-binding-array+) 5053 5061 +lisp-object+))))) 5054 5062 (emit-move-from-stack target)) … … 7887 7895 (return-from analyze-args 7888 7896 (if *closure-variables* 7889 (get-descriptor (list +lisp-object-array+ +lisp-object-array+) 7890 +lisp-object+) 7897 (get-descriptor (list +closure-binding-array+ 7898 +lisp-object-array+) 7899 +lisp-object+) 7891 7900 (get-descriptor (list +lisp-object-array+) 7892 7901 +lisp-object+)))) 7893 7902 (cond (*closure-variables* 7894 7903 (return-from analyze-args 7895 7904 (cond ((<= arg-count call-registers-limit) 7896 (get-descriptor (list* + lisp-object-array+7905 (get-descriptor (list* +closure-binding-array+ 7897 7906 (lisp-object-arg-types arg-count)) 7898 7907 +lisp-object+)) 7899 7908 (t (setf *using-arg-array* t) 7900 7909 (setf (compiland-arity compiland) arg-count) 7901 (get-descriptor (list + lisp-object-array+ +lisp-object-array+) ;; FIXME7910 (get-descriptor (list +closure-binding-array+ +lisp-object-array+) ;; FIXME 7902 7911 +lisp-object+))))) 7903 7912 (t … … 8106 8115 (dformat t "p2-compiland ~S anewarray 1~%" 8107 8116 (compiland-name compiland)) 8108 (emit 'anewarray "org/armedbear/lisp/ LispObject")))8117 (emit 'anewarray "org/armedbear/lisp/ClosureBinding"))) 8109 8118 (dolist (variable closure-args) 8110 8119 (dformat t "moving variable ~S~%" (variable-name variable)) … … 8115 8124 (emit-push-constant-int (variable-closure-index variable)) 8116 8125 (aload (variable-register variable)) 8126 (emit 'new "org/armedbear/lisp/ClosureBinding") 8127 (emit 'dup) 8128 (emit-invokespecial-init "org/armedbear/lisp/ClosureBinding" 8129 (list "Lorg/armedbear/lisp/LisObject;")) 8117 8130 (emit 'aastore) 8118 8131 (setf (variable-register variable) nil)) … … 8123 8136 (emit-push-constant-int (variable-index variable)) 8124 8137 (emit 'aaload) 8138 (emit 'new "org/armedbear/lisp/ClosureBinding") 8139 (emit 'dup) 8140 (emit-invokespecial-init "org/armedbear/lisp/ClosureBinding" 8141 (list "Lorg/armedbear/lisp/LisObject;")) 8125 8142 (emit 'aastore) 8126 8143 (setf (variable-index variable) nil))))
Note: See TracChangeset
for help on using the changeset viewer.