[armedbear-cvs] r14086 - trunk/abcl/src/org/armedbear/lisp

rschlatte at common-lisp.net rschlatte at common-lisp.net
Tue Aug 14 12:40:57 UTC 2012


Author: rschlatte
Date: Tue Aug 14 05:40:56 2012
New Revision: 14086

Log:
Eliminate numberOfRequiredArgs attribute from standard generic function

- calculate it when required instead

Modified:
   trunk/abcl/src/org/armedbear/lisp/FuncallableStandardObject.java
   trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java

Modified: trunk/abcl/src/org/armedbear/lisp/FuncallableStandardObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/FuncallableStandardObject.java	Tue Aug 14 05:16:11 2012	(r14085)
+++ trunk/abcl/src/org/armedbear/lisp/FuncallableStandardObject.java	Tue Aug 14 05:40:56 2012	(r14086)
@@ -41,7 +41,6 @@
 public class FuncallableStandardObject extends StandardObject
 {
   protected LispObject function;
-  protected int numberOfRequiredArgs;
 
   protected FuncallableStandardObject()
   {

Modified: trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java	Tue Aug 14 05:16:11 2012	(r14085)
+++ trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java	Tue Aug 14 05:40:56 2012	(r14086)
@@ -56,7 +56,6 @@
     slots[StandardGenericFunctionClass.SLOT_INDEX_LAMBDA_LIST] = NIL;
     slots[StandardGenericFunctionClass.SLOT_INDEX_REQUIRED_ARGS] = NIL;
     slots[StandardGenericFunctionClass.SLOT_INDEX_OPTIONAL_ARGS] = NIL;
-    numberOfRequiredArgs = 0;
     slots[StandardGenericFunctionClass.SLOT_INDEX_INITIAL_METHODS] = NIL;
     slots[StandardGenericFunctionClass.SLOT_INDEX_METHODS] = NIL;
     slots[StandardGenericFunctionClass.SLOT_INDEX_METHOD_CLASS] =
@@ -228,7 +227,6 @@
     {
       final StandardGenericFunction gf = checkStandardGenericFunction(first);
       gf.slots[StandardGenericFunctionClass.SLOT_INDEX_REQUIRED_ARGS] = second;
-      gf.numberOfRequiredArgs = second.length();
       return second;
     }
   };
@@ -577,8 +575,11 @@
     {
       final StandardGenericFunction gf = checkStandardGenericFunction(first);
       LispObject args = second;
-      LispObject[] array = new LispObject[gf.numberOfRequiredArgs];
-      for (int i = gf.numberOfRequiredArgs; i-- > 0;)
+      int numberOfRequiredArgs
+        = gf.slots[StandardGenericFunctionClass.SLOT_INDEX_REQUIRED_ARGS]
+        .length();
+      LispObject[] array = new LispObject[numberOfRequiredArgs];
+      for (int i = numberOfRequiredArgs; i-- > 0;)
         {
           array[i] = gf.getArgSpecialization(args.car());
           args = args.cdr();
@@ -606,8 +607,11 @@
     {
       final StandardGenericFunction gf = checkStandardGenericFunction(first);
       LispObject args = second;
-      LispObject[] array = new LispObject[gf.numberOfRequiredArgs];
-      for (int i = gf.numberOfRequiredArgs; i-- > 0;)
+      int numberOfRequiredArgs
+        = gf.slots[StandardGenericFunctionClass.SLOT_INDEX_REQUIRED_ARGS]
+        .length();
+      LispObject[] array = new LispObject[numberOfRequiredArgs];
+      for (int i = numberOfRequiredArgs; i-- > 0;)
         {
           array[i] = gf.getArgSpecialization(args.car());
           args = args.cdr();




More information about the armedbear-cvs mailing list