Changeset 12313
- Timestamp:
- 12/29/09 22:58:40 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/AutoloadedFunctionProxy.java
r12311 r12313 47 47 }; 48 48 49 /** List of symbols that need to be saved upon instantiation of a 50 * proxy and restored while loading the actual function. 51 */ 52 final static private Symbol[] symsToSave = 53 new Symbol[] 54 { 55 AUTOLOADING_CACHE, // allow loading local preloaded functions 56 Load._FASL_ANONYMOUS_PACKAGE_, // package for uninterned symbols 57 Symbol._PACKAGE_, // current package 58 Symbol.LOAD_TRUENAME // LOAD-TIME-VALUE depends on this 59 }; 60 49 61 final private Symbol symbol; 50 62 final private String name; 51 63 final private LispObject cache; 52 final private LispObject pack; 53 final private LispObject anonymousPackage; 64 final private LispObject[] savedSyms; 54 65 final private FunctionType fType; 55 66 Function fun = null; 56 67 57 68 public AutoloadedFunctionProxy(Symbol symbol, LispObject name, 58 LispObject cache, LispObject pack,59 LispObject anonymousPackage,69 LispObject cache, 70 LispObject[] savedSyms, 60 71 FunctionType ft) { 61 72 super(); … … 63 74 this.name = name.getStringValue(); 64 75 this.cache = cache; 65 this. pack = pack;76 this.savedSyms = savedSyms; 66 77 Debug.assertTrue(! (cache instanceof Nil)); 67 this.anonymousPackage = anonymousPackage;68 78 this.fType = ft; 69 79 } … … 82 92 SpecialBindingsMark mark = thread.markSpecialBindings(); 83 93 84 thread.bindSpecial(AUTOLOADING_CACHE, cache);85 thread.bindSpecial(Load._FASL_ANONYMOUS_PACKAGE_, anonymousPackage);86 thread.bindSpecial(Symbol._PACKAGE_, pack); 94 for (int i = 0; i < symsToSave.length; i++) 95 thread.bindSpecial(symsToSave[i], savedSyms[i]); 96 87 97 byte[] classbytes = 88 98 (byte[])((Hashtable)cache.javaInstance()).get(name); … … 209 219 Hashtable cache = (Hashtable)value.javaInstance(); 210 220 byte[] bytes = (byte[])cache.get(name); 221 if (bytes == null) 222 return error(new LispError("Function '" + name + "' not preloaded" + 223 " while preloading requested.")); 211 224 try { 212 225 return loadClassBytes(bytes); … … 253 266 254 267 LispObject cache = AUTOLOADING_CACHE.symbolValue(thread); 255 LispObject pack = Symbol._PACKAGE_.symbolValue(thread);256 257 268 if (cache instanceof Nil) 258 269 // during EVAL-WHEN :compile-toplevel, this function will … … 261 272 return loadCompiledFunction(name.getStringValue()); 262 273 else { 263 fun = new AutoloadedFunctionProxy(sym, name, cache, pack, 264 Load._FASL_ANONYMOUS_PACKAGE_.symbolValue(thread), 265 fType); 274 LispObject[] cachedSyms = new LispObject[symsToSave.length]; 275 for (int i = 0; i < symsToSave.length; i++) 276 cachedSyms[i] = symsToSave[i].symbolValue(thread); 277 278 fun = new AutoloadedFunctionProxy(sym, name, cache, 279 cachedSyms, fType); 266 280 267 281 installFunction(fType, sym, fun);
Note: See TracChangeset
for help on using the changeset viewer.