Changeset 13007 for trunk/abcl/src/org


Ignore:
Timestamp:
11/06/10 12:37:25 (11 years ago)
Author:
ehuelsmann
Message:

Eliminate ~80k exceptions (ClassNotFoundException?) during
Maxima compilation by making our FaslClassLoader? handle its
own classes first.

File:
1 edited

Legend:

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

    r12754 r13007  
    5353      } catch(Exception e) {
    5454    //e.printStackTrace();
    55     Debug.trace("useLoaderFunction = true but couldn't fully init FASL loader, will fall back to reflection!");
     55    Debug.trace("useLoaderFunction = true but couldn't fully init FASL loader ("+baseName+"), will fall back to reflection!");
    5656      }
    5757  }
    5858    }
    5959
     60    @Override
     61    protected Class<?> loadClass(String name, boolean resolve)
     62            throws ClassNotFoundException {
     63        /* First we check if we should load the class ourselves,
     64         * allowing the default handlers to kick in if we don't...
     65         *
     66         * This strategy eliminates ClassNotFound exceptions inside
     67         * the inherited loadClass() eliminated ~80k exceptions during
     68         * Maxima compilation. Generally, creation of an exception object
     69         * is a pretty heavy operation, because it processes the call stack,
     70         * which - in ABCL - is pretty deep, most of the time.
     71         */
     72        if (name.startsWith(baseName + "_")) {
     73            String internalName = "org/armedbear/lisp/" + name;
     74            Class<?> c = this.findLoadedClass(internalName);
     75
     76            if (c == null)
     77                c = findClass(name);
     78
     79            if (c != null) {
     80                if (resolve)
     81                    resolveClass(c);
     82
     83                return c;
     84            }
     85        }
     86
     87        // Fall through to our super's default handling
     88        return super.loadClass(name, resolve);
     89    }
     90
     91    @Override
    6092    protected Class<?> findClass(String name) throws ClassNotFoundException {
    6193  try {
Note: See TracChangeset for help on using the changeset viewer.