[armedbear-cvs] r13167 - branches/0.24.x/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Fri Jan 21 20:57:59 UTC 2011


Author: ehuelsmann
Date: Fri Jan 21 15:57:57 2011
New Revision: 13167

Log:
Merge r13148 and r13149: Additional changes to use reflection based
function instantiation.

Modified:
   branches/0.24.x/abcl/src/org/armedbear/lisp/FaslClassLoader.java
   branches/0.24.x/abcl/src/org/armedbear/lisp/Lisp.java
   branches/0.24.x/abcl/src/org/armedbear/lisp/Load.java
   branches/0.24.x/abcl/src/org/armedbear/lisp/compile-file.lisp

Modified: branches/0.24.x/abcl/src/org/armedbear/lisp/FaslClassLoader.java
==============================================================================
--- branches/0.24.x/abcl/src/org/armedbear/lisp/FaslClassLoader.java	(original)
+++ branches/0.24.x/abcl/src/org/armedbear/lisp/FaslClassLoader.java	Fri Jan 21 15:57:57 2011
@@ -39,8 +39,7 @@
 
 public class FaslClassLoader extends JavaClassLoader {
 
-    private String baseName;
-    private LispObject loader; //The function used to load FASL functions by number
+    private final String baseName;
     private final JavaObject boxedThis = new JavaObject(this);
     
     public FaslClassLoader(String baseName) {
@@ -63,13 +62,13 @@
             String internalName = "org/armedbear/lisp/" + name;
             Class<?> c = this.findLoadedClass(internalName);
 
-            if (c == null)
+            if (c == null) {
                 c = findClass(name);
-
+            }
             if (c != null) {
-                if (resolve)
+                if (resolve) {
                     resolveClass(c);
-
+                }
                 return c;
             }
         }
@@ -108,8 +107,10 @@
     public LispObject loadFunction(int fnNumber) {
 	try {
 	    //Function name is fnIndex + 1
-	    LispObject o = (LispObject) loadClass(baseName + "_" + (fnNumber + 1)).newInstance();
-	    return o;
+            String name = baseName + "_" + (fnNumber + 1);
+            Function f = (Function) loadClass(name).newInstance();
+            f.setClassBytes(getFunctionClassBytes(name));
+            return f;
 	} catch(Exception e) {
 	    if(e instanceof ControlTransfer) { throw (ControlTransfer) e; }
             Debug.trace(e);
@@ -128,6 +129,12 @@
             return new FaslClassLoader(baseName.getStringValue()).boxedThis;
         }
 
+        @Override
+        //TODO delete this next time the fasl version is bumbed
+        public LispObject execute(LispObject unused1, LispObject baseName, LispObject unused2) {
+            return execute(baseName);
+        }
+
     };
 
     private static final Primitive GET_FASL_FUNCTION = new pf_get_fasl_function();

Modified: branches/0.24.x/abcl/src/org/armedbear/lisp/Lisp.java
==============================================================================
--- branches/0.24.x/abcl/src/org/armedbear/lisp/Lisp.java	(original)
+++ branches/0.24.x/abcl/src/org/armedbear/lisp/Lisp.java	Fri Jan 21 15:57:57 2011
@@ -1284,6 +1284,7 @@
       try {
           if (input == null) {
                   Debug.trace("Pathname: " + name);
+                  Debug.trace("load: " + load);
                   Debug.trace("LOAD_TRUENAME_FASL: " + truenameFasl);
                   Debug.trace("LOAD_TRUENAME: " + truename);
                   Debug.assertTrue(input != null);

Modified: branches/0.24.x/abcl/src/org/armedbear/lisp/Load.java
==============================================================================
--- branches/0.24.x/abcl/src/org/armedbear/lisp/Load.java	(original)
+++ branches/0.24.x/abcl/src/org/armedbear/lisp/Load.java	Fri Jan 21 15:57:57 2011
@@ -342,6 +342,14 @@
 
     // ### *fasl-version*
     // internal symbol
+
+    /* TODO when bumping the version for any reason, remember to:
+     *  - remove the overload taking 3 args in
+     *    FaslClassLoader.MAKE_FASL_CLASS_LOADER
+     *  - remove the extra args (1 and 3, both NIL) passed to
+     *    make-fasl-class-loader in compile-file.lisp
+     *  - delete this comment :)
+     */
     static final Symbol _FASL_VERSION_ =
         exportConstant("*FASL-VERSION*", PACKAGE_SYS, Fixnum.getInstance(37));
 

Modified: branches/0.24.x/abcl/src/org/armedbear/lisp/compile-file.lisp
==============================================================================
--- branches/0.24.x/abcl/src/org/armedbear/lisp/compile-file.lisp	(original)
+++ branches/0.24.x/abcl/src/org/armedbear/lisp/compile-file.lisp	Fri Jan 21 15:57:57 2011
@@ -369,7 +369,9 @@
   (when compile-time-too
     (let ((*load-truename* *output-file-pathname*)
 	  (*fasl-loader* (make-fasl-class-loader
-                          (concatenate 'string "org.armedbear.lisp." (base-classname)))))
+                          nil
+                          (concatenate 'string "org.armedbear.lisp." (base-classname))
+                          nil)))
       (eval form))))
 
 (declaim (ftype (function (t) t) convert-ensure-method))
@@ -611,7 +613,9 @@
               (when (> *class-number* 0)
                 (write (list 'setq '*fasl-loader*
                              `(sys::make-fasl-class-loader
-                               ,(concatenate 'string "org.armedbear.lisp." (base-classname)))) :stream out))
+                               nil
+                               ,(concatenate 'string "org.armedbear.lisp." (base-classname))
+                               nil)) :stream out))
               (%stream-terpri out))
 
 




More information about the armedbear-cvs mailing list