Changeset 14493
- Timestamp:
- 05/05/13 15:02:32 (10 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Autoload.java
r14490 r14493 553 553 autoload(PACKAGE_SYS, "%%string=", "StringFunctions"); 554 554 autoload(PACKAGE_SYS, "%adjust-array", "adjust_array"); 555 autoload(PACKAGE_SYS, "%clear-emf-cache", "StandardGenericFunction", true);556 555 autoload(PACKAGE_SYS, "%defpackage", "PackageFunctions"); 557 556 autoload(PACKAGE_SYS, "%get-output-stream-bytes", "ByteArrayOutputStream"); //AS 20090325 … … 561 560 autoload(PACKAGE_SYS, "%make-byte-array-output-stream", "ByteArrayOutputStream"); //AS 20090325 562 561 autoload(PACKAGE_SYS, "%make-condition", "make_condition", true); 562 autoload(PACKAGE_SYS, "%make-emf-cache", "EMFCache", true); 563 563 autoload(PACKAGE_SYS, "%make-hash-table", "HashTableFunctions"); 564 564 autoload(PACKAGE_SYS, "%make-hash-table", "HashTableFunctions"); … … 571 571 autoload(PACKAGE_SYS, "%nstring-downcase", "StringFunctions"); 572 572 autoload(PACKAGE_SYS, "%nstring-upcase", "StringFunctions"); 573 autoload(PACKAGE_SYS, "%reinit-emf-cache", "EMFCache", true); 573 574 autoload(PACKAGE_SYS, "%run-shell-command", "ShellCommand"); 574 575 autoload(PACKAGE_SYS, "%server-socket-close", "server_socket_close"); … … 578 579 autoload(PACKAGE_SYS, "%set-class-direct-slots", "SlotClass", true); 579 580 autoload(PACKAGE_SYS, "%set-function-info", "function_info"); 580 autoload(PACKAGE_SYS, "%init-eql-specializations", "StandardGenericFunction", true);581 581 autoload(PACKAGE_SYS, "%set-symbol-macro", "Primitives"); 582 582 autoload(PACKAGE_SYS, "%simple-bit-vector-bit-and", "SimpleBitVector"); … … 610 610 autoload(PACKAGE_SYS, "%string>=", "StringFunctions"); 611 611 autoload(PACKAGE_SYS, "%time", "Time"); 612 autoload(PACKAGE_SYS, "cache-emf", " StandardGenericFunction", true);612 autoload(PACKAGE_SYS, "cache-emf", "EMFCache", true); 613 613 autoload(PACKAGE_SYS, "canonicalize-logical-host", "LogicalPathname", true); 614 614 autoload(PACKAGE_SYS, "%class-direct-slots", "SlotClass"); … … 626 626 autoload(PACKAGE_SYS, "float-string", "FloatFunctions", true); 627 627 autoload(PACKAGE_SYS, "function-info", "function_info"); 628 autoload(PACKAGE_SYS, "get-cached-emf", " StandardGenericFunction", true);628 autoload(PACKAGE_SYS, "get-cached-emf", "EMFCache", true); 629 629 autoload(PACKAGE_SYS, "get-function-info-value", "function_info"); 630 630 autoload(PACKAGE_SYS, "hash-table-entries", "HashTableFunctions"); -
trunk/abcl/src/org/armedbear/lisp/EMFCache.java
r14492 r14493 1 1 /* 2 * StandardGenericFunction.java 3 * 4 * Copyright (C) 2003-2006 Peter Graves 5 * $Id$ 2 * EMFCache.java 3 * 4 * Copyright (C) 2003-2006 Peter Graves, 2013 Rudolf Schlatte 6 5 * 7 6 * This program is free software; you can redistribute it and/or … … 38 37 import java.util.concurrent.ConcurrentHashMap; 39 38 40 public final class StandardGenericFunction extends FuncallableStandardObject39 public final class EMFCache extends LispObject 41 40 { 42 43 41 ConcurrentHashMap<CacheEntry,LispObject> cache 44 42 = new ConcurrentHashMap<CacheEntry,LispObject>();; 45 46 public StandardGenericFunction() 47 { 48 this(StandardClass.STANDARD_GENERIC_FUNCTION.getClassLayout()); 49 } 50 51 public StandardGenericFunction(Layout layout) 52 { 53 super(layout); 54 setInstanceSlotValue(Symbol.NAME, NIL); 55 setInstanceSlotValue(Symbol.LAMBDA_LIST, NIL); 56 setInstanceSlotValue(Symbol.REQUIRED_ARGS, NIL); 57 setInstanceSlotValue(Symbol.OPTIONAL_ARGS, NIL); 58 setInstanceSlotValue(Symbol.INITIAL_METHODS, NIL); 59 setInstanceSlotValue(Symbol.METHODS, NIL); 60 setInstanceSlotValue(Symbol.METHOD_CLASS, StandardClass.STANDARD_METHOD); 61 // method combination class set by clos.lisp:shared-initialize :after 62 setInstanceSlotValue(Symbol._METHOD_COMBINATION, list(Symbol.STANDARD)); 63 setInstanceSlotValue(Symbol.ARGUMENT_PRECEDENCE_ORDER, NIL); 64 setInstanceSlotValue(Symbol.DECLARATIONS, NIL); 65 setInstanceSlotValue(Symbol._DOCUMENTATION, NIL); 66 } 43 EqlSpecialization eqlSpecializations[] = new EqlSpecialization[0]; 67 44 68 45 void clearCache() 69 46 { 70 47 cache = new ConcurrentHashMap<CacheEntry,LispObject>(); 71 }72 73 public LispObject getName()74 {75 return getInstanceSlotValue(Symbol.NAME);76 }77 78 public void setName(LispObject name)79 {80 setInstanceSlotValue(Symbol.NAME, name);81 }82 83 84 @Override85 public LispObject typep(LispObject type)86 {87 if (type == Symbol.STANDARD_GENERIC_FUNCTION)88 return T;89 if (type == StandardClass.STANDARD_GENERIC_FUNCTION)90 return T;91 return super.typep(type);92 48 } 93 49 … … 95 51 public String printObject() 96 52 { 97 LispObject name = getName(); 98 if (name != null) 99 { 100 StringBuilder sb = new StringBuilder(); 101 LispObject className; 102 LispObject lispClass = getLispClass(); 103 if (lispClass instanceof LispClass) 104 className = ((LispClass)lispClass).getName(); 105 else 106 className = Symbol.CLASS_NAME.execute(lispClass); 107 108 sb.append(className.princToString()); 109 sb.append(' '); 110 sb.append(name.princToString()); 111 return unreadableString(sb.toString()); 53 return unreadableString("EMF-CACHE"); 54 } 55 56 static final StandardGenericFunction checkStandardGenericFunction(LispObject obj) 57 { 58 if (obj instanceof StandardGenericFunction) 59 return (StandardGenericFunction) obj; 60 return (StandardGenericFunction) // Not reached. 61 type_error(obj, Symbol.STANDARD_GENERIC_FUNCTION); 62 } 63 64 private static class EqlSpecialization extends LispObject 65 { 66 public LispObject eqlTo; 67 68 public EqlSpecialization(LispObject eqlTo) 69 { 70 this.eqlTo = eqlTo; 71 } 72 } 73 74 private static class CacheEntry 75 { 76 final LispObject[] array; 77 78 CacheEntry(LispObject[] array) 79 { 80 this.array = array; 81 } 82 83 @Override 84 public int hashCode() 85 { 86 int result = 0; 87 for (int i = array.length; i-- > 0;) 88 result ^= array[i].hashCode(); 89 return result; 90 } 91 92 @Override 93 public boolean equals(Object object) 94 { 95 if (!(object instanceof CacheEntry)) 96 return false; 97 final CacheEntry otherEntry = (CacheEntry) object; 98 if (otherEntry.array.length != array.length) 99 return false; 100 final LispObject[] otherArray = otherEntry.array; 101 for (int i = array.length; i-- > 0;) 102 if (array[i] != otherArray[i]) 103 return false; 104 return true; 105 } 106 } 107 108 private static final Primitive _MAKE_EMF_CACHE 109 = new pf__make_emf_cache(); 110 @DocString(name="%make-emf-cache") 111 private static final class pf__make_emf_cache extends Primitive 112 { 113 pf__make_emf_cache() 114 { 115 super("%make-emf-cache", PACKAGE_SYS, true); 116 } 117 @Override 118 public LispObject execute(LispObject arg) 119 { 120 return new EMFCache(); 121 } 122 }; 123 124 private static final Primitive _REINIT_EMF_CACHE 125 = new pf__reinit_emf_cache(); 126 @DocString(name="%reinit-emf-cache", 127 args="generic-function eql-specilizer-objects-list") 128 private static final class pf__reinit_emf_cache extends Primitive 129 { 130 pf__reinit_emf_cache() 131 { 132 super("%reinit-emf-cache", PACKAGE_SYS, true, 133 "generic-function eql-specializer-objects-list"); 134 } 135 @Override 136 public LispObject execute(LispObject generic_function, LispObject eql_specializers) 137 { 138 final StandardGenericFunction gf = checkStandardGenericFunction(generic_function); 139 EMFCache cache = gf.cache; 140 cache.clearCache(); 141 cache.eqlSpecializations = new EqlSpecialization[eql_specializers.length()]; 142 for (int i = 0; i < cache.eqlSpecializations.length; i++) { 143 cache.eqlSpecializations[i] = new EqlSpecialization(eql_specializers.car()); 144 eql_specializers = eql_specializers.cdr(); 112 145 } 113 return super.printObject();114 }115 116 117 private static final Primitive _CLEAR_EMF_CACHE118 = new pf__finalize_generic_function();119 @DocString(name="%clear-emf-cache",120 args="generic-function")121 private static final class pf__finalize_generic_function extends Primitive122 {123 pf__finalize_generic_function()124 {125 super("%clear-emf-cache", PACKAGE_SYS, true,126 "generic-function");127 }128 @Override129 public LispObject execute(LispObject arg)130 {131 final StandardGenericFunction gf = checkStandardGenericFunction(arg);132 gf.clearCache();133 146 return T; 134 147 } 135 148 }; 136 149 137 private static final Primitive CACHE_EMF 150 private static final Primitive CACHE_EMF 138 151 = new pf_cache_emf(); 139 152 @DocString(name="cache-emf", 140 153 args="generic-function args emf") 141 private static final class pf_cache_emf extends Primitive 154 private static final class pf_cache_emf extends Primitive 142 155 { 143 156 pf_cache_emf() … … 150 163 { 151 164 final StandardGenericFunction gf = checkStandardGenericFunction(first); 165 EMFCache cache = gf.cache; 152 166 LispObject args = second; 153 167 int numberOfRequiredArgs … … 156 170 for (int i = numberOfRequiredArgs; i-- > 0;) 157 171 { 158 array[i] = gf.getArgSpecialization(args.car());172 array[i] = cache.getArgSpecialization(args.car()); 159 173 args = args.cdr(); 160 174 } 161 175 CacheEntry specializations = new CacheEntry(array); 162 ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;176 ConcurrentHashMap<CacheEntry,LispObject> ht = cache.cache; 163 177 ht.put(specializations, third); 164 178 return third; … … 170 184 @DocString(name="get-cached-emf", 171 185 args="generic-function args") 172 private static final class pf_get_cached_emf extends Primitive 186 private static final class pf_get_cached_emf extends Primitive 173 187 { 174 188 pf_get_cached_emf() { … … 179 193 { 180 194 final StandardGenericFunction gf = checkStandardGenericFunction(first); 195 EMFCache cache = gf.cache; 181 196 LispObject args = second; 182 197 int numberOfRequiredArgs … … 185 200 for (int i = numberOfRequiredArgs; i-- > 0;) 186 201 { 187 array[i] = gf.getArgSpecialization(args.car());202 array[i] = cache.getArgSpecialization(args.car()); 188 203 args = args.cdr(); 189 204 } 190 205 CacheEntry specializations = new CacheEntry(array); 191 ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;206 ConcurrentHashMap<CacheEntry,LispObject> ht = cache.cache; 192 207 LispObject emf = (LispObject) ht.get(specializations); 193 208 return emf != null ? emf : NIL; … … 196 211 197 212 /** 198 * Returns an object representing generic function 213 * Returns an object representing generic function 199 214 * argument <tt>arg</tt> in a <tt>CacheEntry</tt> 200 215 * … … 202 217 * does not have EQL specialized methods, and therefore 203 218 * only argument types are relevant for choosing 204 * applicable methods, the value returned is the 219 * applicable methods, the value returned is the 205 220 * class of <tt>arg</tt> 206 221 * 207 * <p>If the function has EQL specialized methods: 222 * <p>If the function has EQL specialized methods: 208 223 * - if <tt>arg</tt> is EQL to some of the EQL-specializers, 209 224 * a special object representing equality to that specializer … … 250 265 * { EqlSpecialization('SYMBOL), EqlSpecialization('SYMBOL) }. 251 266 * </pre> 252 */ 267 */ 253 268 LispObject getArgSpecialization(LispObject arg) 254 269 { … … 261 276 } 262 277 263 private static class CacheEntry264 {265 final LispObject[] array;266 267 CacheEntry(LispObject[] array)268 {269 this.array = array;270 }271 272 @Override273 public int hashCode()274 {275 int result = 0;276 for (int i = array.length; i-- > 0;)277 result ^= array[i].hashCode();278 return result;279 }280 281 @Override282 public boolean equals(Object object)283 {284 if (!(object instanceof CacheEntry))285 return false;286 final CacheEntry otherEntry = (CacheEntry) object;287 if (otherEntry.array.length != array.length)288 return false;289 final LispObject[] otherArray = otherEntry.array;290 for (int i = array.length; i-- > 0;)291 if (array[i] != otherArray[i])292 return false;293 return true;294 }295 }296 297 EqlSpecialization eqlSpecializations[] = new EqlSpecialization[0];298 299 private static final Primitive _INIT_EQL_SPECIALIZATIONS300 = new pf__init_eql_specializations();301 @DocString(name="%init-eql-specializations",302 args="generic-function eql-specilizer-objects-list")303 private static final class pf__init_eql_specializations extends Primitive304 {305 pf__init_eql_specializations()306 {307 super("%init-eql-specializations", PACKAGE_SYS, true,308 "generic-function eql-specilizer-objects-list");309 }310 @Override311 public LispObject execute(LispObject first, LispObject second)312 {313 final StandardGenericFunction gf = checkStandardGenericFunction(first);314 LispObject eqlSpecializerObjects = second;315 gf.eqlSpecializations = new EqlSpecialization[eqlSpecializerObjects.length()];316 for (int i = 0; i < gf.eqlSpecializations.length; i++) {317 gf.eqlSpecializations[i] = new EqlSpecialization(eqlSpecializerObjects.car());318 eqlSpecializerObjects = eqlSpecializerObjects.cdr();319 }320 return NIL;321 }322 };323 324 private static class EqlSpecialization extends LispObject325 {326 public LispObject eqlTo;327 328 public EqlSpecialization(LispObject eqlTo)329 {330 this.eqlTo = eqlTo;331 }332 }333 334 private static final StandardGenericFunction checkStandardGenericFunction(LispObject obj)335 {336 if (obj instanceof StandardGenericFunction)337 return (StandardGenericFunction) obj;338 return (StandardGenericFunction) // Not reached.339 type_error(obj, Symbol.STANDARD_GENERIC_FUNCTION);340 }341 278 } -
trunk/abcl/src/org/armedbear/lisp/Primitives.java
r14484 r14493 2661 2661 value1 = NIL; 2662 2662 value2 = T; 2663 value3 = ((StandardGenericFunction)arg).get Name();2663 value3 = ((StandardGenericFunction)arg).getInstanceSlotValue(Symbol.NAME); 2664 2664 } else if (arg instanceof FuncallableStandardObject) { 2665 2665 return this.execute(((FuncallableStandardObject)arg).function); … … 4222 4222 } 4223 4223 if (arg instanceof StandardGenericFunction) { 4224 return ((StandardGenericFunction)arg).get Name();4224 return ((StandardGenericFunction)arg).getInstanceSlotValue(Symbol.NAME); 4225 4225 } 4226 4226 if (arg instanceof FuncallableStandardObject) { … … 4247 4247 } 4248 4248 if (first instanceof StandardGenericFunction) { 4249 ((StandardGenericFunction)first).set Name(second);4249 ((StandardGenericFunction)first).setInstanceSlotValue(Symbol.NAME, second); 4250 4250 return second; 4251 4251 } -
trunk/abcl/src/org/armedbear/lisp/StandardGenericFunction.java
r14491 r14493 36 36 import static org.armedbear.lisp.Lisp.*; 37 37 38 import java.util.concurrent.ConcurrentHashMap;39 40 38 public final class StandardGenericFunction extends FuncallableStandardObject 41 39 { 42 40 43 ConcurrentHashMap<CacheEntry,LispObject> cache 44 = new ConcurrentHashMap<CacheEntry,LispObject>();; 41 EMFCache cache = new EMFCache(); 45 42 46 43 public StandardGenericFunction() … … 66 63 } 67 64 68 void clearCache()69 {70 cache = new ConcurrentHashMap<CacheEntry,LispObject>();71 }72 73 public LispObject getName()74 {75 return getInstanceSlotValue(Symbol.NAME);76 }77 78 public void setName(LispObject name)79 {80 setInstanceSlotValue(Symbol.NAME, name);81 }82 83 84 @Override85 public LispObject typep(LispObject type)86 {87 if (type == Symbol.STANDARD_GENERIC_FUNCTION)88 return T;89 if (type == StandardClass.STANDARD_GENERIC_FUNCTION)90 return T;91 return super.typep(type);92 }93 94 @Override95 public String printObject()96 {97 LispObject name = getName();98 if (name != null)99 {100 StringBuilder sb = new StringBuilder();101 LispObject className;102 LispObject lispClass = getLispClass();103 if (lispClass instanceof LispClass)104 className = ((LispClass)lispClass).getName();105 else106 className = Symbol.CLASS_NAME.execute(lispClass);107 108 sb.append(className.princToString());109 sb.append(' ');110 sb.append(name.princToString());111 return unreadableString(sb.toString());112 }113 return super.printObject();114 }115 116 117 private static final Primitive _CLEAR_EMF_CACHE118 = new pf__finalize_generic_function();119 @DocString(name="%clear-emf-cache",120 args="generic-function")121 private static final class pf__finalize_generic_function extends Primitive122 {123 pf__finalize_generic_function()124 {125 super("%clear-emf-cache", PACKAGE_SYS, true,126 "generic-function");127 }128 @Override129 public LispObject execute(LispObject arg)130 {131 final StandardGenericFunction gf = checkStandardGenericFunction(arg);132 gf.clearCache();133 return T;134 }135 };136 137 private static final Primitive CACHE_EMF138 = new pf_cache_emf();139 @DocString(name="cache-emf",140 args="generic-function args emf")141 private static final class pf_cache_emf extends Primitive142 {143 pf_cache_emf()144 {145 super("cache-emf", PACKAGE_SYS, true, "generic-function args emf");146 }147 @Override148 public LispObject execute(LispObject first, LispObject second,149 LispObject third)150 {151 final StandardGenericFunction gf = checkStandardGenericFunction(first);152 LispObject args = second;153 int numberOfRequiredArgs154 = gf.getInstanceSlotValue(Symbol.REQUIRED_ARGS).length();155 LispObject[] array = new LispObject[numberOfRequiredArgs];156 for (int i = numberOfRequiredArgs; i-- > 0;)157 {158 array[i] = gf.getArgSpecialization(args.car());159 args = args.cdr();160 }161 CacheEntry specializations = new CacheEntry(array);162 ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;163 ht.put(specializations, third);164 return third;165 }166 };167 168 private static final Primitive GET_CACHED_EMF169 = new pf_get_cached_emf();170 @DocString(name="get-cached-emf",171 args="generic-function args")172 private static final class pf_get_cached_emf extends Primitive173 {174 pf_get_cached_emf() {175 super("get-cached-emf", PACKAGE_SYS, true, "generic-function args");176 }177 @Override178 public LispObject execute(LispObject first, LispObject second)179 {180 final StandardGenericFunction gf = checkStandardGenericFunction(first);181 LispObject args = second;182 int numberOfRequiredArgs183 = gf.getInstanceSlotValue(Symbol.REQUIRED_ARGS).length();184 LispObject[] array = new LispObject[numberOfRequiredArgs];185 for (int i = numberOfRequiredArgs; i-- > 0;)186 {187 array[i] = gf.getArgSpecialization(args.car());188 args = args.cdr();189 }190 CacheEntry specializations = new CacheEntry(array);191 ConcurrentHashMap<CacheEntry,LispObject> ht = gf.cache;192 LispObject emf = (LispObject) ht.get(specializations);193 return emf != null ? emf : NIL;194 }195 };196 197 /**198 * Returns an object representing generic function199 * argument <tt>arg</tt> in a <tt>CacheEntry</tt>200 *201 * <p>In the simplest case, when this generic function202 * does not have EQL specialized methods, and therefore203 * only argument types are relevant for choosing204 * applicable methods, the value returned is the205 * class of <tt>arg</tt>206 *207 * <p>If the function has EQL specialized methods:208 * - if <tt>arg</tt> is EQL to some of the EQL-specializers,209 * a special object representing equality to that specializer210 * is returned.211 * - otherwise class of the <tt>arg</tt> is returned.212 *213 * <p>Note that we do not consider argument position, when214 * calculating arg specialization. In rare cases (when one argument215 * is eql-specialized to a symbol specifying class of another216 * argument) this may result in redundant cache entries caching the217 * same method. But the method cached is anyway correct for the218 * arguments (because in case of cache miss, correct method is219 * calculated by other code, which does not rely on220 * getArgSpecialization; and because EQL is true only for objects of221 * the same type, which guaranties that if a type-specialized222 * methods was chached by eql-specialization, all the cache hits223 * into this records will be from args of the conforming type).224 *225 * <p>Consider:226 * <pre><tt>227 * (defgeneric f (a b))228 *229 * (defmethod f (a (b (eql 'symbol)))230 * "T (EQL 'SYMBOL)")231 *232 * (defmethod f ((a symbol) (b (eql 'symbol)))233 * "SYMBOL (EQL 'SYMBOL)")234 *235 * (f 12 'symbol)236 * => "T (EQL 'SYMBOL)"237 *238 * (f 'twelve 'symbol)239 * => "SYMBOL (EQL 'SYMBOL)"240 *241 * (f 'symbol 'symbol)242 * => "SYMBOL (EQL 'SYMBOL)"243 *244 * </tt></pre>245 *246 * After the two above calls <tt>cache</tt> will contain three keys:247 * <pre>248 * { class FIXNUM, EqlSpecialization('SYMBOL) }249 * { class SYMBOL, EqlSpecialization('SYMBOL) }250 * { EqlSpecialization('SYMBOL), EqlSpecialization('SYMBOL) }.251 * </pre>252 */253 LispObject getArgSpecialization(LispObject arg)254 {255 for (EqlSpecialization eqlSpecialization : eqlSpecializations)256 {257 if (eqlSpecialization.eqlTo.eql(arg))258 return eqlSpecialization;259 }260 return arg.classOf();261 }262 263 private static class CacheEntry264 {265 final LispObject[] array;266 267 CacheEntry(LispObject[] array)268 {269 this.array = array;270 }271 272 @Override273 public int hashCode()274 {275 int result = 0;276 for (int i = array.length; i-- > 0;)277 result ^= array[i].hashCode();278 return result;279 }280 281 @Override282 public boolean equals(Object object)283 {284 if (!(object instanceof CacheEntry))285 return false;286 final CacheEntry otherEntry = (CacheEntry) object;287 if (otherEntry.array.length != array.length)288 return false;289 final LispObject[] otherArray = otherEntry.array;290 for (int i = array.length; i-- > 0;)291 if (array[i] != otherArray[i])292 return false;293 return true;294 }295 }296 297 EqlSpecialization eqlSpecializations[] = new EqlSpecialization[0];298 299 private static final Primitive _INIT_EQL_SPECIALIZATIONS300 = new pf__init_eql_specializations();301 @DocString(name="%init-eql-specializations",302 args="generic-function eql-specilizer-objects-list")303 private static final class pf__init_eql_specializations extends Primitive304 {305 pf__init_eql_specializations()306 {307 super("%init-eql-specializations", PACKAGE_SYS, true,308 "generic-function eql-specilizer-objects-list");309 }310 @Override311 public LispObject execute(LispObject first, LispObject second)312 {313 final StandardGenericFunction gf = checkStandardGenericFunction(first);314 LispObject eqlSpecializerObjects = second;315 gf.eqlSpecializations = new EqlSpecialization[eqlSpecializerObjects.length()];316 for (int i = 0; i < gf.eqlSpecializations.length; i++) {317 gf.eqlSpecializations[i] = new EqlSpecialization(eqlSpecializerObjects.car());318 eqlSpecializerObjects = eqlSpecializerObjects.cdr();319 }320 return NIL;321 }322 };323 324 private static class EqlSpecialization extends LispObject325 {326 public LispObject eqlTo;327 328 public EqlSpecialization(LispObject eqlTo)329 {330 this.eqlTo = eqlTo;331 }332 }333 334 private static final StandardGenericFunction checkStandardGenericFunction(LispObject obj)335 {336 if (obj instanceof StandardGenericFunction)337 return (StandardGenericFunction) obj;338 return (StandardGenericFunction) // Not reached.339 type_error(obj, Symbol.STANDARD_GENERIC_FUNCTION);340 }341 65 } -
trunk/abcl/src/org/armedbear/lisp/clos.lisp
r14492 r14493 1820 1820 1821 1821 (defun finalize-standard-generic-function (gf) 1822 (%clear-emf-cache gf) 1823 (%init-eql-specializations gf (collect-eql-specializer-objects gf)) 1822 (%reinit-emf-cache gf (collect-eql-specializer-objects gf)) 1824 1823 (set-funcallable-instance-function 1825 1824 gf
Note: See TracChangeset
for help on using the changeset viewer.