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

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Wed Aug 15 22:55:27 UTC 2012


Author: ehuelsmann
Date: Wed Aug 15 15:55:27 2012
New Revision: 14096

Log:
Don't generate empty static initializers.

Note: Given that this commit shrinks our JAR by more than 3k
   and the fact that these methods only contain 1 byte, we
   must have had quite a number of them...

Modified:
   trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
   trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Wed Aug 15 15:16:20 2012	(r14095)
+++ trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Wed Aug 15 15:55:27 2012	(r14096)
@@ -1084,7 +1084,9 @@
   (with-code-to-method (class (abcl-class-file-constructor class))
     (emit 'return))
   (with-code-to-method (class (abcl-class-file-static-initializer class))
-    (emit 'return))
+    (if (= 0 (length *code*))
+        (class-remove-method class (abcl-class-file-static-initializer class))
+        (emit 'return)))
   (when *compiler-debug*
     (print "; Writing class file ")
     (print (abcl-class-file-class-name class))

Modified: trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp	Wed Aug 15 15:16:20 2012	(r14095)
+++ trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp	Wed Aug 15 15:55:27 2012	(r14096)
@@ -763,6 +763,11 @@
                       (equal (method-descriptor c) return-and-args)))
              (class-file-methods class))))
 
+(defun class-remove-method (class method)
+  (setf (class-file-methods class)
+        (remove method (class-file-methods class)))
+  method)
+
 (defun class-add-attribute (class attribute)
   "Adds `attribute' to the class; attributes must be instances of
 structure classes which include the `attribute' structure class."




More information about the armedbear-cvs mailing list