Index: NEWS
===================================================================
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.37
diff -u -r1.37 NEWS
--- NEWS	8 Apr 2004 06:47:53 -0000	1.37
+++ NEWS	22 Apr 2004 09:53:16 -0000
@@ -2,6 +2,9 @@
 
 VM Interface changes:
 
+* java.lang.Class/VMClass interface was changed. The interface now no
+longer requires an instance of VMClass for each Class instance. Instead
+the field vmdata in Class is now of type Object.
 * GNU Classpath now assumes that JNI calls SetXField can modify final
 fields. This was previously used silently for System.in/out/err and should
 be considered as a feature now. 
Index: java/lang/Class.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Class.java,v
retrieving revision 1.18
diff -u -r1.18 Class.java
--- java/lang/Class.java	17 Apr 2004 17:08:22 -0000	1.18
+++ java/lang/Class.java	22 Apr 2004 09:53:31 -0000
@@ -105,7 +105,7 @@
     unknownProtectionDomain = new ProtectionDomain(null, permissions);
   }
 
-  transient final VMClass vmClass;
+  transient final Object vmdata;
 
   /** newInstance() caches the default constructor */
   private transient Constructor constructor;
@@ -114,9 +114,9 @@
    * Class is non-instantiable from Java code; only the VM can create
    * instances of this class.
    */
-  Class(VMClass vmClass)
+  Class(Object vmdata)
   {
-    this.vmClass = vmClass;
+    this.vmdata = vmdata;
   }
 
   /**
@@ -190,7 +190,7 @@
 	if (c != null)
 	  {
 	    if (initialize)
-	      c.vmClass.initialize();
+	      VMClass.initialize(c);
 	    return c;
 	  }
         throw new ClassNotFoundException(name);
@@ -200,7 +200,7 @@
     Class c = classloader.loadClass(name);
     classloader.resolveClass(c);
     if (initialize)
-      c.vmClass.initialize();
+      VMClass.initialize(c);
     return c;
   }
   
@@ -256,7 +256,7 @@
     if (name.startsWith("java.") || name.startsWith("gnu.java."))
       return null;
 
-    ClassLoader loader = vmClass.getClassLoader();
+    ClassLoader loader = VMClass.getClassLoader(this);
     // Check if we may get the classloader
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
@@ -282,7 +282,7 @@
    */
   public Class getComponentType()
   {
-    return vmClass.getComponentType ();
+    return VMClass.getComponentType (this);
   }
 
   /**
@@ -378,7 +378,7 @@
 
   Class[] getDeclaredClasses (boolean publicOnly)
   {
-    return vmClass.getDeclaredClasses (publicOnly);
+    return VMClass.getDeclaredClasses (this, publicOnly);
   }
 
   /**
@@ -401,7 +401,7 @@
 
   Constructor[] getDeclaredConstructors (boolean publicOnly)
   {
-    return vmClass.getDeclaredConstructors (publicOnly);
+    return VMClass.getDeclaredConstructors (this, publicOnly);
   }
   
   /**
@@ -449,7 +449,7 @@
 
   Field[] getDeclaredFields (boolean publicOnly)
   {
-    return vmClass.getDeclaredFields (publicOnly);
+    return VMClass.getDeclaredFields (this, publicOnly);
   }
 
   /**
@@ -507,7 +507,7 @@
 
   Method[] getDeclaredMethods (boolean publicOnly)
   {
-    return vmClass.getDeclaredMethods (publicOnly);
+    return VMClass.getDeclaredMethods (this, publicOnly);
   }
  
   /**
@@ -519,7 +519,7 @@
    */
   public Class getDeclaringClass()
   {
-    return vmClass.getDeclaringClass ();
+    return VMClass.getDeclaringClass (this);
   }
 
   /**
@@ -608,7 +608,7 @@
    */
   public Class[] getInterfaces()
   {
-    return vmClass.getInterfaces ();
+    return VMClass.getInterfaces (this);
   }
 
   private static final class MethodKey
@@ -837,7 +837,7 @@
    */
   public int getModifiers()
   {
-    return vmClass.getModifiers ();
+    return VMClass.getModifiers (this);
   }
   
   /**
@@ -862,7 +862,7 @@
    */
   public String getName()
   { 
-    return vmClass.getName ();
+    return VMClass.getName (this);
   }
 
   /**
@@ -969,7 +969,7 @@
    */
   public Class getSuperclass()
   {
-    return vmClass.getSuperclass ();
+    return VMClass.getSuperclass (this);
   }
   
   /**
@@ -980,11 +980,7 @@
    */
   public boolean isArray()
   {
-    int result = -1;
-    if ((result = vmClass.isArray ()) < 0)
-      return getName().charAt(0) == '[';
-
-    return result == 1;
+    return VMClass.isArray (this);
   }
   
   /**
@@ -1003,7 +999,7 @@
    */
   public boolean isAssignableFrom(Class c)
   {
-    return vmClass.isAssignableFrom (c);
+    return VMClass.isAssignableFrom (this, c);
   }
  
   /**
@@ -1016,7 +1012,7 @@
    */
   public boolean isInstance(Object o)
   {
-    return vmClass.isInstance (o);
+    return VMClass.isInstance (this, o);
   }
   
   /**
@@ -1027,7 +1023,7 @@
    */
   public boolean isInterface()
   {
-    return vmClass.isInterface ();
+    return VMClass.isInterface (this);
   }
   
   /**
@@ -1051,7 +1047,7 @@
    */
   public boolean isPrimitive()
   {
-    return vmClass.isPrimitive ();
+    return VMClass.isPrimitive (this);
   }
   
   /**
Index: vm/reference/java/lang/VMClass.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMClass.java,v
retrieving revision 1.8
diff -u -r1.8 VMClass.java
--- vm/reference/java/lang/VMClass.java	17 Apr 2003 12:32:29 -0000	1.8
+++ vm/reference/java/lang/VMClass.java	22 Apr 2004 09:53:48 -0000
@@ -1,5 +1,5 @@
 /* VMClass.java -- VM Specific Class methods
-   Copyright (C) 2003 Free Software Foundation
+   Copyright (C) 2003, 2004 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -37,7 +37,6 @@
 
 package java.lang;
 
-import gnu.classpath.RawData;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -68,17 +67,6 @@
   private native void step7();
   private native void step8();
 
-  /**
-   * Pointer to VM internal class structure.
-   */
-
-  private final RawData vmData;  
-
-  private VMClass(RawData vmData) 
-  { 
-    this.vmData = vmData;
-  }
-
   private void initialize(int thread) throws InterruptedException
   {
     Error error;
@@ -156,11 +144,12 @@
    * Discover whether an Object is an instance of this Class.  Think of it
    * as almost like <code>o instanceof (this class)</code>.
    *
+   * @param klass the Class object that's calling us
    * @param o the Object to check
    * @return whether o is an instance of this class
    * @since 1.1
    */
-  native boolean isInstance(Object o);
+  static native boolean isInstance(Class klass, Object o);
 
   /**
    * Discover whether an instance of the Class parameter would be an
@@ -170,21 +159,23 @@
    * checks widening conversions for objects, it must be exact for primitive
    * types.
    *
+   * @param klass the Class object that's calling us
    * @param c the class to check
    * @return whether an instance of c would be an instance of this class
    *         as well
    * @throws NullPointerException if c is null
    * @since 1.1
    */
-  native boolean isAssignableFrom(Class c);
+  static native boolean isAssignableFrom(Class klass, Class c);
 
   /**
    * Check whether this class is an interface or not.  Array types are not
    * interfaces.
    *
+   * @param klass the Class object that's calling us
    * @return whether this class is an interface or not
    */
-  native boolean isInterface();
+  static native boolean isInterface(Class klass);
 
   /**
    * Return whether this class is a primitive type.  A primitive type class
@@ -193,6 +184,7 @@
    * classes through java.lang.Boolean.TYPE, java.lang.Integer.TYPE, etc.,
    * or through boolean.class, int.class, etc.
    *
+   * @param klass the Class object that's calling us
    * @return whether this class is a primitive type
    * @see Boolean#TYPE
    * @see Byte#TYPE
@@ -205,7 +197,7 @@
    * @see Void#TYPE
    * @since 1.1
    */
-  native boolean isPrimitive();
+  static native boolean isPrimitive(Class klass);
 
   /**
    * Get the name of this class, separated by dots for package separators.
@@ -224,18 +216,20 @@
    * class or interface, alone: &lt;dotted name&gt;
    * class or interface, as element type: L&lt;dotted name&gt;;
    *
+   * @param klass the Class object that's calling us
    * @return the name of this class
    */
-  native String getName();
+  static native String getName(Class klass);
 
   /**
    * Get the direct superclass of this class.  If this is an interface,
    * Object, a primitive type, or void, it will return null. If this is an
    * array type, it will return Object.
    *
+   * @param klass the Class object that's calling us
    * @return the direct superclass of this class
    */
-  native Class getSuperclass();
+  static native Class getSuperclass(Class klass);
 
   /**
    * Get the interfaces this class <EM>directly</EM> implements, in the
@@ -243,9 +237,10 @@
    * for Object, primitives, void, and classes or interfaces with no direct
    * superinterface. Array types return Cloneable and Serializable.
    *
+   * @param klass the Class object that's calling us
    * @return the interfaces this class directly implements
    */
-  native Class[] getInterfaces();
+  static native Class[] getInterfaces(Class klass);
 
   /**
    * If this is an array, get the Class representing the type of array.
@@ -253,11 +248,12 @@
    * calling getComponentType on that would give "java.lang.String".  If
    * this is not an array, returns null.
    *
+   * @param klass the Class object that's calling us
    * @return the array type of this class, or null
    * @see Array
    * @since 1.1
    */
-  native Class getComponentType();
+  static native Class getComponentType(Class klass);
 
   /**
    * Get the modifiers of this class.  These can be decoded using Modifier,
@@ -267,56 +263,63 @@
    * marked final but not an interface. Primitive types and void are marked
    * public and final, but not an interface.
    *
+   * @param klass the Class object that's calling us
    * @return the modifiers of this class
    * @see Modifer
    * @since 1.1
    */
-  native int getModifiers();
+  static native int getModifiers(Class klass);
 
   /**
    * If this is a nested or inner class, return the class that declared it.
    * If not, return null.
    *
+   * @param klass the Class object that's calling us
    * @return the declaring class of this class
    * @since 1.1
    */
-  native Class getDeclaringClass();
+  static native Class getDeclaringClass(Class klass);
 
   /**
    * Like <code>getDeclaredClasses()</code> but without the security checks.
    *
+   * @param klass the Class object that's calling us
    * @param pulicOnly Only public classes should be returned
    */
-  native Class[] getDeclaredClasses(boolean publicOnly);
+  static native Class[] getDeclaredClasses(Class klass, boolean publicOnly);
 
   /**
    * Like <code>getDeclaredFields()</code> but without the security checks.
    *
+   * @param klass the Class object that's calling us
    * @param pulicOnly Only public fields should be returned
    */
-  native Field[] getDeclaredFields(boolean publicOnly);
+  static native Field[] getDeclaredFields(Class klass, boolean publicOnly);
 
   /**
    * Like <code>getDeclaredMethods()</code> but without the security checks.
    *
+   * @param klass the Class object that's calling us
    * @param pulicOnly Only public methods should be returned
    */
-  native Method[] getDeclaredMethods(boolean publicOnly);
+  static native Method[] getDeclaredMethods(Class klass, boolean publicOnly);
 
   /**
    * Like <code>getDeclaredConstructors()</code> but without
    * the security checks.
    *
+   * @param klass the Class object that's calling us
    * @param pulicOnly Only public constructors should be returned
    */
-  native Constructor[] getDeclaredConstructors(boolean publicOnly);
+  static native Constructor[] getDeclaredConstructors(Class klass, boolean publicOnly);
 
   /**
    * Return the class loader of this class.
    *
+   * @param klass the Class object that's calling us
    * @return the class loader
    */
-  native ClassLoader getClassLoader();
+  static native ClassLoader getClassLoader(Class klass);
 
   /**
    * VM implementors are free to make this method a noop if 
@@ -335,19 +338,21 @@
   /**
    * Return whether this class is an array type.
    *
-   * @return 1 if this class is an array type, 0 otherwise, -1 if unsupported
+   * @param klass the Class object that's calling us
+   * @return true if this class is an array type
    * operation
    */
-  native int isArray();
+  static native boolean isArray(Class klass);
 
   /**
    * This method should trigger class initialization (if the
    * class hasn't already been initialized)
    * 
+   * @param klass the Class object that's calling us
    * @throws ExceptionInInitializerError if an exception
    *         occurs during initialization
    */
-  native void initialize();
+  static native void initialize(Class klass);
 
   /**
    * Load an array class.
