[armedbear-cvs] r13013 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Mon Nov 8 22:34:21 UTC 2010


Author: ehuelsmann
Date: Mon Nov  8 17:34:18 2010
New Revision: 13013

Log:
Reduce the impact of the fasl-loader "_0" class's maximum size of 64kB:
this change reduces the size of pprint_0.cls from 23001 to 19380 bytes,
a saving of 18.64%, which is probably much more when counting the size
of the execute() method alone.

Modified:
   trunk/abcl/src/org/armedbear/lisp/compile-file.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/compile-file.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compile-file.lisp	(original)
+++ trunk/abcl/src/org/armedbear/lisp/compile-file.lisp	Mon Nov  8 17:34:18 2010
@@ -679,7 +679,14 @@
 (defun generate-loader-function ()
   (let* ((basename (base-classname))
 	 (expr `(lambda (fasl-loader fn-index)
-		  (identity fasl-loader) ;;to avoid unused arg
+                  (declare (type (integer 0 256000) fn-index))
+                  (identity fasl-loader) ;;to avoid unused arg
+                  (jvm::with-inline-code ()
+                    (jvm::emit 'jvm::aload 1)
+                    (jvm::emit-invokevirtual jvm::+lisp-object+ "javaInstance"
+                                             nil jvm::+java-object+)
+                    (jvm::emit-checkcast +fasl-classloader+)
+                    (jvm::emit 'jvm::iload 2))
 		  (ncase fn-index 0 ,(1- *class-number*)
 		    ,@(loop
 			 :for i :from 1 :to *class-number*
@@ -687,20 +694,14 @@
 			 (let* ((class (%format nil "org/armedbear/lisp/~A_~A"
                                                 basename i))
                                 (class-name (jvm::make-class-name class)))
-			   `(,(1- i)
-			      (jvm::with-inline-code ()
-				(jvm::emit 'jvm::aload 1)
-				(jvm::emit-invokevirtual jvm::+lisp-object+ "javaInstance"
-							 nil jvm::+java-object+)
-				(jvm::emit-checkcast +fasl-classloader+)
-				(jvm::emit 'jvm::dup)
-				(jvm::emit-push-constant-int ,(1- i))
-				(jvm::emit-new ,class-name)
-				(jvm::emit 'jvm::dup)
-				(jvm::emit-invokespecial-init ,class-name '())
-				(jvm::emit-invokevirtual +fasl-classloader+
+                           `(,(1- i)
+                              (jvm::with-inline-code ()
+                                (jvm::emit-new ,class-name)
+                                (jvm::emit 'jvm::dup)
+                                (jvm::emit-invokespecial-init ,class-name '())
+                                (jvm::emit-invokevirtual +fasl-classloader+
                                                          "putFunction"
-							 (list :int jvm::+lisp-object+) jvm::+lisp-object+)
+                                                         (list :int jvm::+lisp-object+) jvm::+lisp-object+)
 				(jvm::emit 'jvm::pop))
 			      t))))))
 	 (classname (fasl-loader-classname))




More information about the armedbear-cvs mailing list