[armedbear-cvs] r14002 - in trunk/abcl/src/org/armedbear/lisp: . scripting

mevenson at common-lisp.net mevenson at common-lisp.net
Thu Jul 12 09:25:41 UTC 2012


Author: mevenson
Date: Thu Jul 12 02:25:37 2012
New Revision: 14002

Log:
dmiles: SYS:*COMPILE-FILE-CLASS-EXTENSION* contains PATHNAME TYPE of compiled JVM artifacts.

The default "cls" of compiled JVM artifacts was chosen to easily
differentiate bewtween JVM artifacts not produced by ABCL and those
which are the JVM bytecode of the ABCL Java 5.0 compiler.  During the
bootstrapping and subsequent debugging of the current compiler, this
distinction has proven more useful than giving ABCL produced artifacts
the default "class" CL:PATHNAME TYPE.

This change facilitates the bootstrapping of [running ABCL on the MSFT
.NET CLR underway by dmiles][abcl-ikvm]

[abcl-ikvm]:  http://code.google.com/r/logicmoo-abcl-ikvm

dmiles:  Implementation of ticket #34.

dmiles: It makes no change at first but makes implmentation satisfactory to my
initial request.

Modified:
   trunk/abcl/src/org/armedbear/lisp/FaslClassLoader.java
   trunk/abcl/src/org/armedbear/lisp/Lisp.java
   trunk/abcl/src/org/armedbear/lisp/Load.java
   trunk/abcl/src/org/armedbear/lisp/compile-file.lisp
   trunk/abcl/src/org/armedbear/lisp/compile-system.lisp
   trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngine.java

Modified: trunk/abcl/src/org/armedbear/lisp/FaslClassLoader.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/FaslClassLoader.java	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/FaslClassLoader.java	Thu Jul 12 02:25:37 2012	(r14002)
@@ -111,7 +111,7 @@
     }
 
     public byte[] getFunctionClassBytes(String name) {
-        Pathname pathname = new Pathname(name.substring("org/armedbear/lisp/".length()) + ".cls");
+        Pathname pathname = new Pathname(name.substring("org/armedbear/lisp/".length()) + "." + Lisp._COMPILE_FILE_CLASS_EXTENSION_.symbolValue().getStringValue());
         return readFunctionBytes(pathname);
     }
 

Modified: trunk/abcl/src/org/armedbear/lisp/Lisp.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Lisp.java	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/Lisp.java	Thu Jul 12 02:25:37 2012	(r14002)
@@ -2482,10 +2482,12 @@
    internSpecial("*AUTOLOADING-CACHE*", PACKAGE_SYS, NIL);
 
   // ### *compile-file-type*
-  public static final String COMPILE_FILE_TYPE = "abcl";
   public static final Symbol _COMPILE_FILE_TYPE_ =
-    internConstant("*COMPILE-FILE-TYPE*", PACKAGE_SYS,
-                   new SimpleString(COMPILE_FILE_TYPE));
+   exportSpecial("*COMPILE-FILE-TYPE*", PACKAGE_SYS, new SimpleString("abcl"));    
+  
+  // ### *compile-file-class-extension*
+  public static final Symbol _COMPILE_FILE_CLASS_EXTENSION_ =
+   exportSpecial("*COMPILE-FILE-CLASS-EXTENSION*", PACKAGE_SYS, new SimpleString("cls"));
 
   // ### *compile-file-zip*
   public static final Symbol _COMPILE_FILE_ZIP_ =

Modified: trunk/abcl/src/org/armedbear/lisp/Load.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Load.java	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/Load.java	Thu Jul 12 02:25:37 2012	(r14002)
@@ -73,6 +73,7 @@
                 return t;
             }
         }
+        final String COMPILE_FILE_TYPE = Lisp._COMPILE_FILE_TYPE_.symbolValue().getStringValue();
         if (name.type == NIL
             && (name.name != NIL || name.name != null)) {
             Pathname lispPathname = new Pathname(name);
@@ -80,7 +81,7 @@
             lispPathname.invalidateNamestring();
             LispObject lisp = Pathname.truename(lispPathname, false);
             Pathname abclPathname = new Pathname(name);
-            abclPathname.type = new SimpleString("abcl");
+            abclPathname.type = new SimpleString(COMPILE_FILE_TYPE);
             abclPathname.invalidateNamestring();
             LispObject abcl = Pathname.truename(abclPathname, false);
             if (lisp instanceof Pathname && abcl instanceof Pathname) {
@@ -262,12 +263,13 @@
         }
         URL url = null;
         truename = findLoadableFile(mergedPathname);
+        final String COMPILE_FILE_TYPE = Lisp._COMPILE_FILE_TYPE_.symbolValue().getStringValue();
         if (truename == null || truename.equals(NIL) || bootPath.equals(NIL)) {
             // Make an attempt to use the boot classpath
             String path = pathname.asEntryPath();
-            url = Lisp.class.getResource(path);
+            url = Lisp.class.getResource(path);            
             if (url == null || url.toString().endsWith("/")) {
-                url = Lisp.class.getResource(path.replace('-', '_') + ".abcl");
+                url = Lisp.class.getResource(path.replace('-', '_') + "." + COMPILE_FILE_TYPE);
                 if (url == null) {
                     url = Lisp.class.getResource(path + ".lisp");
                 }
@@ -476,7 +478,7 @@
             if (!truename.equals(NIL)) {
                 truePathname = new Pathname(((Pathname)truename).getNamestring());
                 String type = truePathname.type.getStringValue();
-                if (type.equals(COMPILE_FILE_TYPE)
+                if (type.equals(Lisp._COMPILE_FILE_TYPE_.symbolValue(thread).getStringValue())
                     || type.equals(COMPILE_FILE_INIT_FASL_TYPE.toString())) {
                     Pathname truenameFasl = new Pathname(truePathname);
                     thread.bindSpecial(Symbol.LOAD_TRUENAME_FASL, truenameFasl);

Modified: trunk/abcl/src/org/armedbear/lisp/compile-file.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compile-file.lisp	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/compile-file.lisp	Thu Jul 12 02:25:37 2012	(r14002)
@@ -53,7 +53,7 @@
   (let ((name
          (sanitize-class-name
 	  (%format nil "~A_~D" (pathname-name output-file-pathname) n))))
-    (namestring (merge-pathnames (make-pathname :name name :type "cls")
+    (namestring (merge-pathnames (make-pathname :name name :type *compile-file-class-extension*)
                                  output-file-pathname))))
 
 (defun sanitize-class-name (name)
@@ -616,7 +616,7 @@
          (pathnames nil)
          (fasl-loader (namestring (merge-pathnames
                                    (make-pathname :name (fasl-loader-classname)
-                                                  :type "cls")
+                                                  :type *compile-file-class-extension*)
                                    output-file))))
     (when (probe-file fasl-loader)
       (push fasl-loader pathnames))

Modified: trunk/abcl/src/org/armedbear/lisp/compile-system.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compile-system.lisp	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/compile-system.lisp	Thu Jul 12 02:25:37 2012	(r14002)
@@ -86,7 +86,7 @@
     (unless output-path
       (setf output-path *default-pathname-defaults*))
     (flet ((do-compile (file)
-             (let ((out (make-pathname :type "abcl"
+             (let ((out (make-pathname :type *compile-file-type*
                                        :defaults (merge-pathnames
                                                   file output-path))))
                (compile-file-if-needed file :output-file out))))
@@ -273,8 +273,10 @@
                            "write-sequence.lisp")))
     t))
 
-(defun compile-system (&key quit (zip t) output-path)
-  (let ((status -1))
+(defun compile-system (&key quit (zip t) (cls-ext *compile-file-class-extension*) (abcl-ext *compile-file-type*) output-path)
+  (let ((status -1)
+	(*compile-file-class-extension* cls-ext)
+	(*compile-file-type* abcl-ext))
     (check-lisp-home)
     (time
      (with-compilation-unit ()

Modified: trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngine.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngine.java	Wed Jul 11 04:04:16 2012	(r14001)
+++ trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngine.java	Thu Jul 12 02:25:37 2012	(r14002)
@@ -136,7 +136,8 @@
 	}
 
 	public static boolean isCompiled(String filespec) {
-		if (filespec.endsWith(".abcl")) {
+		final String compiledExt = "." + Lisp._COMPILE_FILE_TYPE_.symbolValue().getStringValue();
+		if (filespec.endsWith(compiledExt)) {
 			return true;
 		}
 		File source;
@@ -144,10 +145,10 @@
 		if (filespec.endsWith(".lisp")) {
 			source = new File(filespec);
 			compiled = new File(filespec.substring(0, filespec.length() - 5)
-					+ ".abcl");
+					+ compiledExt);
 		} else {
 			source = new File(filespec + ".lisp");
-			compiled = new File(filespec + ".abcl");
+			compiled = new File(filespec + compiledExt);
 		}
 		if (!source.exists()) {
 			throw new IllegalArgumentException("The source file " + filespec + " cannot be found");




More information about the armedbear-cvs mailing list