Changeset 13850
- Timestamp:
- 02/04/12 13:09:35 (11 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/ArgumentListProcessor.java
r13849 r13850 546 546 * including validation of the keywords passed. */ 547 547 private class SlowMatcher extends ArgumentMatcher { 548 private LispObject[] _match(LispObject[] args, Environment _environment, 549 Environment env, LispThread thread) { 550 final ArgList argslist = new ArgList(_environment, args); 551 final LispObject[] array = new LispObject[variables.length]; 552 int index = 0; 553 554 555 for (Param p : positionalParameters) 556 index = p.assign(index, array, argslist, env, thread); 557 558 if (andKey) { 559 argslist.assertRemainderKeywords(); 560 561 for (Param p : keywordParameters) 562 index = p.assign(index, array, argslist, env, thread); 563 } 564 for (Param p : auxVars) 565 index = p.assign(index, array, argslist, env, thread); 566 567 if (andKey) { 568 if (allowOtherKeys) 569 return array; 570 571 if (!argslist.consumed()) // verify keywords 572 { 573 LispObject allowOtherKeysValue = 574 argslist.findKeywordArg(Keyword.ALLOW_OTHER_KEYS, NIL); 575 576 if (allowOtherKeysValue != NIL) 577 return array; 578 579 // verify keywords 580 next_key: 581 while (! argslist.consumed()) { 582 LispObject key = argslist.consume(); 583 argslist.consume(); // consume value 584 585 if (key == Keyword.ALLOW_OTHER_KEYS) 586 continue next_key; 587 588 for (KeywordParam k : keywordParameters) 589 if (k.keyword == key) 590 continue next_key; 591 592 error(new ProgramError("Unrecognized keyword argument " + 593 key.printObject())); 594 } 595 } 596 } 597 598 if (restVar == null && !argslist.consumed()) 599 error(new WrongNumberOfArgumentsException(function)); 600 601 return array; 602 } 603 548 604 @Override 549 605 LispObject[] match(LispObject[] args, Environment _environment, … … 561 617 error(new WrongNumberOfArgumentsException(function, minArgs, -1)); 562 618 619 if (thread == null) 620 return _match(args, _environment, env, thread); 563 621 564 622 final SpecialBindingsMark mark = thread.markSpecialBindings(); 565 final LispObject[] array = new LispObject[variables.length];566 int index = 0;567 ArgList argslist = new ArgList(_environment, args);568 569 623 try { 570 for (Param p : positionalParameters) 571 index = p.assign(index, array, argslist, env, thread); 572 573 if (andKey) { 574 argslist.assertRemainderKeywords(); 575 576 for (Param p : keywordParameters) 577 index = p.assign(index, array, argslist, env, thread); 578 } 579 for (Param p : auxVars) 580 index = p.assign(index, array, argslist, env, thread); 581 582 if (andKey) { 583 if (allowOtherKeys) 584 return array; 585 586 if (!argslist.consumed()) // verify keywords 587 { 588 LispObject allowOtherKeysValue = 589 argslist.findKeywordArg(Keyword.ALLOW_OTHER_KEYS, NIL); 590 591 if (allowOtherKeysValue != NIL) 592 return array; 593 594 // verify keywords 595 next_key: 596 while (! argslist.consumed()) { 597 LispObject key = argslist.consume(); 598 argslist.consume(); // consume value 599 600 if (key == Keyword.ALLOW_OTHER_KEYS) 601 continue next_key; 602 603 for (KeywordParam k : keywordParameters) 604 if (k.keyword == key) 605 continue next_key; 606 607 error(new ProgramError("Unrecognized keyword argument " + 608 key.printObject())); 609 } 610 } 611 } 612 613 if (restVar == null && !argslist.consumed()) 614 error(new WrongNumberOfArgumentsException(function)); 615 616 return array; 624 return _match(args, _environment, env, thread); 617 625 } 618 626 finally { -
trunk/abcl/src/org/armedbear/lisp/Closure.java
r13849 r13850 222 222 } 223 223 224 // No optional or keyword parameters.225 protected final LispObject[] fastProcessArgs(LispObject[] args)226 {227 return arglist.match(args, environment, null, null);228 }229 230 224 // ### lambda-list-names 231 225 private static final Primitive LAMBDA_LIST_NAMES = -
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r13849 r13850 7047 7047 (class-file (compiland-class-file compiland)) 7048 7048 (*this-class* (abcl-class-file-class class-file)) 7049 (args (cadr p1-result))7050 7049 (closure-args (intersection *closure-variables* 7051 7050 (compiland-arg-vars compiland))) … … 7234 7233 (aver (not (null (compiland-argument-register compiland)))) 7235 7234 (aload (compiland-argument-register compiland)) ; arg vector 7236 (cond ((or (memq '&OPTIONAL args) (memq '&KEY args)) 7237 (ensure-thread-var-initialized) 7238 (maybe-initialize-thread-var) 7239 (emit-push-current-thread) 7240 (emit-invokevirtual *this-class* "processArgs" 7241 (list +lisp-object-array+ +lisp-thread+) 7242 +lisp-object-array+)) 7243 (t 7244 (emit-invokevirtual *this-class* "fastProcessArgs" 7245 (list +lisp-object-array+) 7246 +lisp-object-array+))) 7235 (emit 'aconst_null) ;; no thread arg required: 7236 ;; there's no non-constant initform or special 7237 ;; which might require the thread 7238 (emit-invokevirtual *this-class* "processArgs" 7239 (list +lisp-object-array+ +lisp-thread+) 7240 +lisp-object-array+) 7247 7241 (astore (compiland-argument-register compiland))) 7248 7242 7249 (unless (and *hairy-arglist-p* 7250 (or (memq '&OPTIONAL args) (memq '&KEY args))) 7251 (maybe-initialize-thread-var)) 7252 (setf *code* (nconc code *code*))) 7253 )) 7243 (maybe-initialize-thread-var) 7244 (setf *code* (nconc code *code*))))) 7254 7245 t) 7255 7246 -
trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp
r13849 r13850 190 190 (define-class-name +alp-keyword-parameter+ 191 191 "org.armedbear.lisp.ArgumentListProcessor$KeywordParam") 192 (defconstant +lisp-closure-parameter-array+193 (class-array +lisp-closure-parameter+))194 192 195 193 #|
Note: See TracChangeset
for help on using the changeset viewer.