classpath
[Top][All Lists]
Advanced

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

Re: Class/VMClass change


From: Mark Wielaard
Subject: Re: Class/VMClass change
Date: Sun, 25 Apr 2004 14:02:18 +0200

Hi,

On Thu, 2004-04-22 at 11:58, Jeroen Frijters wrote:
> Since nobody objected, I'm going to be committing the change to
> Class/VMClass that removes the need for a VMClass instance.

Thanks. I played a bit with it by implementing the necessary support
into jamvm (not that hard at all and it looks like this new setup makes
most operations slightly more efficient). You forgot to remove a couple
of unused instance methods which assume some specific VM-specific Thread
representation (int).  I cleaned this up and also made the class
uninstantiable and package private.

2004-04-25  Mark Wielaard  <address@hidden>

       * vm/reference/java/lang/VMClass.java: Make final and package local.
       Add private constructor.  Removed all instance fields and methods.

Cheers,

Mark
Index: vm/reference/java/lang/VMClass.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMClass.java,v
retrieving revision 1.9
diff -u -r1.9 VMClass.java
--- vm/reference/java/lang/VMClass.java 22 Apr 2004 16:18:36 -0000      1.9
+++ vm/reference/java/lang/VMClass.java 25 Apr 2004 11:48:35 -0000
@@ -53,91 +53,12 @@
  * @author Archie Cobbs <address@hidden>
  * @author C. Brian Jones <address@hidden>
  */
-public final class VMClass 
+final class VMClass 
 {
-  /*
-   * Class initialization mostly-in-Java copied from SableVM.
-   * The steps below follow the JVM spec, 2nd edition, sec. 2.17.5.
-   */
-  private int initializing_thread;
-  private boolean erroneous_state;
 
-  private native boolean isInitialized();
-  private native void setInitialized();
-  private native void step7();
-  private native void step8();
-
-  private void initialize(int thread) throws InterruptedException
+  // Only static methods. Cannot be instantiated.
+  private VMClass()
   {
-    Error error;
-
-    /* 1 */
-    synchronized (this)
-    {
-      /* 2 */
-      while (initializing_thread != 0 && initializing_thread != thread)
-        wait();
-
-      /* 3 */
-      if (initializing_thread == thread)
-        return;
-
-      /* 4 */
-      if (isInitialized())
-        return;
-
-      /* 5 */
-      if (erroneous_state)
-        throw new NoClassDefFoundError();
-
-      /* 6 */
-      initializing_thread = thread;
-    }
-
-    /* 7 */
-    try {
-      step7();
-    }
-    catch(Error e) {
-      synchronized(this) {
-        erroneous_state = true;
-        initializing_thread = 0;
-        notifyAll();
-        throw e;
-      }
-    }
-
-    /* 8 */
-    try {
-      step8();
-
-      /* 9 */
-      synchronized(this) {
-        setInitialized();
-        initializing_thread = 0;
-        notifyAll();
-        return;
-      }
-    }
-
-    /* 10 */
-    catch(Exception e) {
-      try {
-        error = new ExceptionInInitializerError(e);
-      } catch (OutOfMemoryError e2) {
-        error = e2;
-      }
-    } catch(Error e) {
-      error = e;
-    }
-
-    /* 11 */
-    synchronized(this) {
-      erroneous_state = true;
-      initializing_thread = 0;
-      notifyAll();
-      throw error;
-    }
   }
 
   /**

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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