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

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Sat Aug 20 21:55:30 UTC 2011


Author: ehuelsmann
Date: Sat Aug 20 14:55:30 2011
New Revision: 13519

Log:
Generate <clinit>() functions for the initialization of static variables.
After this change, it should be possible to run the constructor of
compiled functions more than once.

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

Modified: trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Sat Aug 20 14:53:51 2011	(r13518)
+++ trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Sat Aug 20 14:55:30 2011	(r13519)
@@ -1060,8 +1060,6 @@
 				 :void nil :flags '(:public :static))))
     ;; We don't normally need to see debugging output for <clinit>.
     (with-code-to-method (class method)
-      (setf (code-max-locals *current-code-attribute*) 0)
-      (emit 'return)
       method)))
 
 (defvar *source-line-number* nil)
@@ -1074,6 +1072,8 @@
 extend the class any further."
   (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))
   (finalize-class-file class)
   (write-class-file class stream))
 
@@ -1307,7 +1307,7 @@
       (cond
         ((not *file-compilation*)
          (with-code-to-method
-             (*class-file* (abcl-class-file-constructor *class-file*))
+             (*class-file* (abcl-class-file-static-initializer *class-file*))
            (remember field-name object)
            (emit 'ldc (pool-string field-name))
            (emit-invokestatic +lisp+ "recall"
@@ -1320,7 +1320,7 @@
          (emit-putstatic *this-class* field-name field-type))
         (t
          (with-code-to-method
-             (*class-file* (abcl-class-file-constructor *class-file*))
+             (*class-file* (abcl-class-file-static-initializer *class-file*))
            (funcall dispatch-fn object)
            (emit-putstatic *this-class* field-name field-type))))
 
@@ -7076,7 +7076,6 @@
            (make-constructor class-file (compiland-name compiland) args)))
       (setf (abcl-class-file-constructor class-file) constructor)
       (class-add-method class-file constructor))
-    #+enable-when-generating-clinit
     (let ((clinit (make-static-initializer class-file)))
       (setf (abcl-class-file-static-initializer class-file) clinit)
       (class-add-method class-file clinit))




More information about the armedbear-cvs mailing list