Changeset 12313


Ignore:
Timestamp:
12/29/09 22:58:40 (11 years ago)
Author:
ehuelsmann
Message:

Fix LOAD-TIME-VALUE instability introduced by r12306,

best seen as failures in CLOS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/AutoloadedFunctionProxy.java

    r12311 r12313  
    4747    };
    4848
     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
    4961    final private Symbol symbol;
    5062    final private String name;
    5163    final private LispObject cache;
    52     final private LispObject pack;
    53     final private LispObject anonymousPackage;
     64    final private LispObject[] savedSyms;
    5465    final private FunctionType fType;
    5566    Function fun = null;
    5667
    5768    public AutoloadedFunctionProxy(Symbol symbol, LispObject name,
    58                                    LispObject cache, LispObject pack,
    59                                    LispObject anonymousPackage,
     69                                   LispObject cache,
     70                                   LispObject[] savedSyms,
    6071                                   FunctionType ft) {
    6172        super();
     
    6374        this.name = name.getStringValue();
    6475        this.cache = cache;
    65         this.pack = pack;
     76        this.savedSyms = savedSyms;
    6677        Debug.assertTrue(! (cache instanceof Nil));
    67         this.anonymousPackage = anonymousPackage;
    6878        this.fType = ft;
    6979    }
     
    8292        SpecialBindingsMark mark = thread.markSpecialBindings();
    8393
    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
    8797        byte[] classbytes =
    8898            (byte[])((Hashtable)cache.javaInstance()).get(name);
     
    209219      Hashtable cache = (Hashtable)value.javaInstance();
    210220      byte[] bytes = (byte[])cache.get(name);
     221      if (bytes == null)
     222          return error(new LispError("Function '" + name + "' not preloaded" +
     223                                     " while preloading requested."));
    211224      try {
    212225        return loadClassBytes(bytes);
     
    253266
    254267        LispObject cache = AUTOLOADING_CACHE.symbolValue(thread);
    255         LispObject pack = Symbol._PACKAGE_.symbolValue(thread);
    256 
    257268        if (cache instanceof Nil)
    258269            // during EVAL-WHEN :compile-toplevel, this function will
     
    261272            return loadCompiledFunction(name.getStringValue());
    262273        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);
    266280
    267281            installFunction(fType, sym, fun);
Note: See TracChangeset for help on using the changeset viewer.