classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch for 0.12 (was: Re: java.lang.System changes)


From: Steven Augart
Subject: Re: patch for 0.12 (was: Re: java.lang.System changes)
Date: Sat, 13 Nov 2004 12:38:13 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Mark Wielaard wrote:
Thanks to you both for working on this issue.
This works for now, but I hope you won't mind if we rip it out again for
0.13. One Thing I don't like about this is that it creates a new compile
time constant which makes it harder to share an GNU Classpath glibj.zip
class byte code between runtimes installed on the same system. I would
like to see something like the following for breaking up the
initialization of java.lang.System into two phases in the future:

 boolean explicitly_initialize = VMSystem.explicitlyInitializeStatics();
 if (explicitly_initialize)
   {
     initLoadLibrary();
     initProperties();
   }

That way a runtime could introduce its own VMSystem, but still share the
system installed glibj.zip.

I have made a patch to accomplish this.  Works with Jikes RVM.
It includes the new method in VMSystem, so other users would have to add that
before they could run with this version.

--Steve A
--- classpath.base/configure.ac 2004-11-12 11:05:50.000000000 -0500
+++ classpath/configure.ac      2004-11-13 11:45:52.000000000 -0500
@@ -289,22 +289,6 @@
 
 
 dnl -----------------------------------------------------------
-dnl Should the VM explicitly run class initialization subfunctions for
-dnl java.lang.System?   (default is false -- the subfunctions will be run 
-dnl automatically by the class initializer)
-dnl -----------------------------------------------------------
-AC_ARG_ENABLE([java-lang-system-explicit-initialization],
-              
[AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM 
explicitly invoke java.lang.System's static initialization methods 
[default=no])],
-              [case "${enableval}" in 
-                yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
-                no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
-                *) AC_MSG_ERROR(bad value ${enableval} for 
--enable-java-lang-system-explicit-initialization) ;;
-              esac],
-              [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
-AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
-
-
-dnl -----------------------------------------------------------
 dnl avoiding automake complaints
 dnl -----------------------------------------------------------
 REMOVE=""
--- classpath.base/ChangeLog    2004-11-12 11:55:12.000000000 -0500
+++ classpath/ChangeLog 2004-11-13 12:36:22.000000000 -0500
@@ -1,3 +1,15 @@
+2004-11-13  Steven Augart  <address@hidden>
+
+       * vm/reference/java/lang/VMSystem.java (explicitlyInitializeStatics): 
+       New method.
+       * java/lang/System.java: Test
+       VMSystem.explicitlyInitializeStatics() instead of
+       Configuration.JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION. 
+       * gnu/classpath/Configuration.java.in: Remove
+       JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION. 
+       * configure.ac: Remove 
+       --enable-java-lang-system-explicit-initialization. 
+       
 2004-11-12  Steven Augart  <address@hidden>
 
        * gnu/classpath/Configuration.java.in: Added
@@ -7,7 +19,6 @@
        * java/lang/System.java: Added support for
        JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION. 
        
-       
 2004-11-12  Sven de Marothy  <address@hidden>
 
         * java/awt/Polygon.java (contains): Reimplemented.
--- classpath.base/java/lang/System.java        2004-11-12 11:02:42.000000000 
-0500
+++ classpath/java/lang/System.java     2004-11-13 11:51:18.000000000 -0500
@@ -122,7 +122,7 @@
    */
   static
   {
-    if (! Configuration.JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION) {
+    if (! VMSystem.explicitlyInitializeStatics()) {
       initLoadLibrary();
       initProperties();
     }
@@ -132,7 +132,7 @@
     out = VMSystem.makeStandardOutputStream();
     err = VMSystem.makeStandardErrorStream();
     
-    if (! Configuration.JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION) {
+    if (! VMSystem.explicitlyInitializeStatics()) {
       initSystemClassLoader();
       initSecurityManager();    // Includes getting the class loader.
     }
--- classpath.base/vm/reference/java/lang/VMSystem.java 2004-10-02 
11:19:16.000000000 -0400
+++ classpath/vm/reference/java/lang/VMSystem.java      2004-11-13 
12:29:07.000000000 -0500
@@ -181,4 +181,19 @@
    *         environment variable is not defined.
    */
   static native String getenv(String name);
+
+  /**
+   * Whether to automatically run the init* methods in java.lang.System
+   * (the default) at class initialization time or whether to have the VM
+   * explicitly invoke them.
+   *
+   * With the default implementation, returning false, the VM does not
+   * explicitly run the initializers; instead, they're automatically
+   * run when java.lang.System is initialized.  This reflects historic
+   * behavior.
+   */
+  static boolean explicitlyInitializeStatics() 
+  {
+    return false;
+  }
 }
--- classpath.base/gnu/classpath/Configuration.java.in  2004-11-12 
10:40:58.000000000 -0500
+++ classpath/gnu/classpath/Configuration.java.in       2004-11-13 
11:49:17.000000000 -0500
@@ -111,16 +111,4 @@
    * Name of default AWT peer library.
    */
   String default_awt_peer_toolkit = "gnu.java.awt.peer.gtk.GtkToolkit";
-
-  /**
-   * Whether to automatically run the init* methods in java.lang.System
-   * (the default) at class initialization time or whether to have the VM
-   * explicitly invoke them.
-   *
-   * The default is false, meaning the VM does not explicitly run the
-   * initializers. 
-   * 
-   */
-  boolean JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = 
-         @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@;
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]