Changeset 11882
- Timestamp:
- 05/16/09 16:44:29 (14 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/ClosureTemplateFunction.java
r11866 r11882 63 63 64 64 65 66 // execute methods have the semantic meaning67 // "evaluate this object"68 @Override69 public final LispObject execute() throws ConditionThrowable70 {71 return _execute(ctx);72 }73 74 @Override75 public final LispObject execute(LispObject arg) throws ConditionThrowable76 {77 return _execute(ctx, arg);78 }79 80 @Override81 public final LispObject execute(LispObject first, LispObject second)82 throws ConditionThrowable83 {84 return _execute(ctx, first, second);85 }86 87 @Override88 public final LispObject execute(LispObject first, LispObject second,89 LispObject third)90 throws ConditionThrowable91 {92 return _execute(ctx, first, second, third);93 }94 95 @Override96 public final LispObject execute(LispObject first, LispObject second,97 LispObject third, LispObject fourth)98 throws ConditionThrowable99 {100 return _execute(ctx, first, second, third, fourth);101 }102 103 @Override104 public final LispObject execute(LispObject first, LispObject second,105 LispObject third, LispObject fourth,106 LispObject fifth)107 throws ConditionThrowable108 {109 return _execute(ctx, first, second, third, fourth, fifth);110 }111 112 @Override113 public final LispObject execute(LispObject first, LispObject second,114 LispObject third, LispObject fourth,115 LispObject fifth, LispObject sixth)116 throws ConditionThrowable117 {118 return _execute(ctx, first, second, third, fourth, fifth, sixth);119 }120 121 @Override122 public final LispObject execute(LispObject first, LispObject second,123 LispObject third, LispObject fourth,124 LispObject fifth, LispObject sixth,125 LispObject seventh)126 throws ConditionThrowable127 {128 return _execute(ctx, first, second, third, fourth, fifth, sixth, seventh);129 }130 131 @Override132 public final LispObject execute(LispObject first, LispObject second,133 LispObject third, LispObject fourth,134 LispObject fifth, LispObject sixth,135 LispObject seventh, LispObject eighth)136 throws ConditionThrowable137 {138 return _execute(ctx, first, second, third, fourth, fifth,139 sixth, seventh, eighth);140 }141 142 @Override143 public final LispObject execute(LispObject[] args)144 throws ConditionThrowable145 {146 return _execute(ctx, args);147 }148 149 65 private final LispObject notImplemented() throws ConditionThrowable 150 66 { … … 153 69 154 70 155 // _execute methods have the semantic meaning156 // "evaluate this template with these values"157 158 71 // Zero args. 159 public LispObject _execute(ClosureBinding[] context) throws ConditionThrowable72 public LispObject execute() throws ConditionThrowable 160 73 { 161 74 LispObject[] args = new LispObject[0]; 162 return _execute(context,args);75 return execute(args); 163 76 } 164 77 165 78 // One arg. 166 public LispObject _execute(ClosureBinding[] context,LispObject first)79 public LispObject execute( LispObject first) 167 80 throws ConditionThrowable 168 81 { 169 82 LispObject[] args = new LispObject[1]; 170 83 args[0] = first; 171 return _execute(context,args);84 return execute(args); 172 85 } 173 86 174 87 // Two args. 175 public LispObject _execute(ClosureBinding[] context,LispObject first,88 public LispObject execute( LispObject first, 176 89 LispObject second) 177 90 throws ConditionThrowable … … 180 93 args[0] = first; 181 94 args[1] = second; 182 return _execute(context,args);95 return execute(args); 183 96 } 184 97 185 98 // Three args. 186 public LispObject _execute(ClosureBinding[] context,LispObject first,99 public LispObject execute( LispObject first, 187 100 LispObject second, LispObject third) 188 101 throws ConditionThrowable … … 192 105 args[1] = second; 193 106 args[2] = third; 194 return _execute(context,args);107 return execute(args); 195 108 } 196 109 197 110 // Four args. 198 public LispObject _execute(ClosureBinding[] context,LispObject first,111 public LispObject execute( LispObject first, 199 112 LispObject second, LispObject third, 200 113 LispObject fourth) … … 206 119 args[2] = third; 207 120 args[3] = fourth; 208 return _execute(context,args);121 return execute(args); 209 122 } 210 123 211 124 // Five args. 212 public LispObject _execute(ClosureBinding[] context,LispObject first,125 public LispObject execute( LispObject first, 213 126 LispObject second, LispObject third, 214 127 LispObject fourth, LispObject fifth) … … 221 134 args[3] = fourth; 222 135 args[4] = fifth; 223 return _execute(context,args);136 return execute(args); 224 137 } 225 138 226 139 // Six args. 227 public LispObject _execute(ClosureBinding[] context,LispObject first,140 public LispObject execute( LispObject first, 228 141 LispObject second, LispObject third, 229 142 LispObject fourth, LispObject fifth, … … 238 151 args[4] = fifth; 239 152 args[5] = sixth; 240 return _execute(context,args);153 return execute(args); 241 154 } 242 155 243 156 // Seven args. 244 public LispObject _execute(ClosureBinding[] context,LispObject first,157 public LispObject execute( LispObject first, 245 158 LispObject second, LispObject third, 246 159 LispObject fourth, LispObject fifth, … … 256 169 args[5] = sixth; 257 170 args[6] = seventh; 258 return _execute(context,args);171 return execute(args); 259 172 } 260 173 261 174 // Eight args. 262 public LispObject _execute(ClosureBinding[] context,LispObject first,175 public LispObject execute( LispObject first, 263 176 LispObject second, LispObject third, 264 177 LispObject fourth, LispObject fifth, … … 276 189 args[6] = seventh; 277 190 args[7] = eighth; 278 return _execute(context,args);191 return execute(args); 279 192 } 280 193 281 194 // Arg array. 282 public LispObject _execute(ClosureBinding[] context,LispObject[] args)195 public LispObject execute(LispObject[] args) 283 196 throws ConditionThrowable 284 197 { -
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r11881 r11882 7859 7859 (setf *hairy-arglist-p* t) 7860 7860 (return-from analyze-args 7861 (if *closure-variables* 7862 (get-descriptor (list +closure-binding-array+ 7863 +lisp-object-array+) 7864 +lisp-object+) 7865 (get-descriptor (list +lisp-object-array+) 7866 +lisp-object+)))) 7867 (cond (*closure-variables* 7868 (return-from analyze-args 7869 (cond ((<= arg-count call-registers-limit) 7870 (get-descriptor (list* +closure-binding-array+ 7871 (lisp-object-arg-types arg-count)) 7872 +lisp-object+)) 7873 (t (setf *using-arg-array* t) 7874 (setf (compiland-arity compiland) arg-count) 7875 (get-descriptor (list +closure-binding-array+ +lisp-object-array+) ;; FIXME 7876 +lisp-object+))))) 7877 (t 7878 (return-from analyze-args 7879 (cond ((<= arg-count call-registers-limit) 7880 (get-descriptor (lisp-object-arg-types arg-count) 7881 +lisp-object+)) 7882 (t (setf *using-arg-array* t) 7883 (setf (compiland-arity compiland) arg-count) 7884 (get-descriptor (list +lisp-object-array+) 7885 +lisp-object+))))))) ;; FIXME 7861 (get-descriptor (list +lisp-object-array+) +lisp-object+))) 7862 (return-from analyze-args 7863 (cond ((<= arg-count call-registers-limit) 7864 (get-descriptor (lisp-object-arg-types arg-count) +lisp-object+)) 7865 (t (setf *using-arg-array* t) 7866 (setf (compiland-arity compiland) arg-count) 7867 (get-descriptor (list +lisp-object-array+) +lisp-object+))))) 7886 7868 (when (or (memq '&KEY args) 7887 7869 (memq '&OPTIONAL args) … … 8017 7999 8018 8000 (descriptor (analyze-args compiland)) 8019 (execute-method (make-method :name (if (and *child-p* 8020 *closure-variables*) 8021 "_execute" "execute") 8001 (execute-method (make-method :name "execute" 8022 8002 :descriptor descriptor)) 8023 8003 (*code* ()) … … 8041 8021 (setf (method-descriptor-index execute-method) 8042 8022 (pool-name (method-descriptor execute-method))) 8043 8044 (when (and *closure-variables* *child-p*)8045 (setf (compiland-closure-register compiland)8046 (allocate-register)) ;; register 1: the closure array8047 (dformat t "p2-compiland 1 closure register = ~S~%"8048 (compiland-closure-register compiland)))8049 8023 8050 8024 (when *using-arg-array* … … 8065 8039 (setf *thread* (allocate-register)) 8066 8040 8067 (when (and *closure-variables* (not *child-p*))8041 (when *closure-variables* 8068 8042 (setf (compiland-closure-register compiland) (allocate-register)) 8069 8043 (dformat t "p2-compiland 2 closure register = ~S~%" … … 8071 8045 8072 8046 (when *closure-variables* 8073 (cond 8074 ((not *child-p*) 8075 ;; if we're the ultimate parent: create the closure array 8076 (emit-push-constant-int (length *closure-variables*)) 8077 (emit 'anewarray +closure-binding-class+)) 8078 (local-closure-vars 8079 (duplicate-closure-array compiland)))) 8047 (if (not *child-p*) 8048 (progn 8049 ;; if we're the ultimate parent: create the closure array 8050 (emit-push-constant-int (length *closure-variables*)) 8051 (emit 'anewarray +closure-binding-class+)) 8052 (progn 8053 (aload 0) 8054 (emit 'getfield +lisp-ctf-class+ "ctx" 8055 +closure-binding-array+) 8056 (when local-closure-vars 8057 ;; in all other cases, it gets stored in the register below 8058 (emit 'astore (compiland-closure-register compiland)) 8059 (duplicate-closure-array compiland))))) 8080 8060 8081 8061 ;; Move args from their original registers to the closure variables array … … 8118 8098 (emit 'aastore))))) 8119 8099 8120 (when (or local-closure-vars (and *closure-variables* (not *child-p*)))8100 (when *closure-variables* 8121 8101 (aver (not (null (compiland-closure-register compiland)))) 8122 8102 (astore (compiland-closure-register compiland))
Note: See TracChangeset
for help on using the changeset viewer.