Hi,

For those that want to test GNU Classpath CVS and use jamvm-1.1.3 you
will now need the following patch to get the new Class/VMClass setup
working.

Make sure you delete your old installation the lib/classes.tar in your
jamvm build dir.

If you want to test the new Process/VMProcess implementation you will
also need the attached VMRuntime patch.

Cheers,

Mark
Binary files jamvm-1.1.3/lib/classes.tar and /home/mark/src/jamvm-1.1.3/lib/classes.tar differ
diff -uNr jamvm-1.1.3/lib/java/io/VMObjectStreamClass.java /home/mark/src/jamvm-1.1.3/lib/java/io/VMObjectStreamClass.java
--- jamvm-1.1.3/lib/java/io/VMObjectStreamClass.java	2004-04-12 23:44:49.000000000 +0200
+++ /home/mark/src/jamvm-1.1.3/lib/java/io/VMObjectStreamClass.java	1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-/*
-  VMObjectStreamClass.java -- jamvm (workarounds) for (VM)ObjectStreamClass.
-*/
-
-package java.io;
-
-import java.lang.reflect.Field;
-
-final class VMObjectStreamClass
-{
-  static boolean hasClassInitializer (Class clazz) {
-    return VMClass.hasClassInitializer(clazz);
-  }
-
-  static native void setDoubleNative(Field field, Object obj, double val);
-  static native void setFloatNative(Field field, Object obj, float val);
-  static native void setLongNative(Field field, Object obj, long val);
-  static native void setIntNative(Field field, Object obj, int val);
-  static native void setShortNative(Field field, Object obj, short val);
-  static native void setCharNative(Field field, Object obj, char val);
-  static native void setByteNative(Field field, Object obj, byte val);
-  static native void setBooleanNative(Field field, Object obj, boolean val);
-  static native void setObjectNative(Field field, Object obj, Object val);
-}
diff -uNr jamvm-1.1.3/lib/java/lang/VMClass.java /home/mark/src/jamvm-1.1.3/lib/java/lang/VMClass.java
--- jamvm-1.1.3/lib/java/lang/VMClass.java	2004-03-25 06:51:45.000000000 +0100
+++ /home/mark/src/jamvm-1.1.3/lib/java/lang/VMClass.java	2004-04-23 13:36:43.000000000 +0200
@@ -46,9 +46,10 @@
 
 import java.lang.reflect.*;
 
-public final class VMClass 
+final class VMClass 
 {
-  private Class clazz;
+
+  // Only static methods. Cannot be instantiated.
   private VMClass() 
   { 
   }
@@ -57,11 +58,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 klazz, Object o);
 
   /**
    * Discover whether an instance of the Class parameter would be an
@@ -71,21 +73,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
@@ -94,6 +98,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
@@ -106,7 +111,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.
@@ -125,18 +130,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
@@ -144,9 +151,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.
@@ -154,11 +162,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,
@@ -168,56 +177,64 @@
    * 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 
@@ -236,19 +253,21 @@
   /**
    * Return whether this class is an array type.
    *
+   * @param klass the Class object that's calling us
    * @return 1 if this class is an array type, 0 otherwise, -1 if unsupported
    * 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.
@@ -264,6 +283,4 @@
    * Throw a checked exception without declaring it.
    */
   static native void throwException(Throwable t);
-
-  public static native boolean hasClassInitializer(Class c);
 } // class VMClass
diff -uNr jamvm-1.1.3/src/class.c /home/mark/src/jamvm-1.1.3/src/class.c
--- jamvm-1.1.3/src/class.c	2004-04-12 03:10:18.000000000 +0200
+++ /home/mark/src/jamvm-1.1.3/src/class.c	2004-04-23 11:52:03.000000000 +0200
@@ -43,11 +43,6 @@
 Class *java_lang_Class = NULL;
 Class *java_lang_VMClass = NULL;
 
-/* Field offsets into Class and VMClass objects - used when
-   preparing a new class. */
-static int vmClass_offset;
-int clazz_offset; /* Not static as referenced by native.c */
-
 /* Method table index of ClassLoader.loadClass - used when
    requesting a Java-level class loader to load a class.
    Cached on first use. */
@@ -94,33 +89,15 @@
 
 static void prepareClass(Class *class) {
     ClassBlock *cb = CLASS_CB(class);
-    Object *vmClass;
 
     if(strcmp(cb->name,"java/lang/Class") == 0)
        class->class = class;
     else {
-       if(java_lang_Class == NULL) {
-          FieldBlock *field;
+       if(java_lang_Class == NULL)
           java_lang_Class = findSystemClass0("java/lang/Class");
-	  if((field = findField(java_lang_Class, "vmClass", "Ljava/lang/VMClass;")) == NULL)
-              goto init_error;
-	  vmClass_offset = field->offset;
-       }
        class->class = java_lang_Class;
     }
 
-    if(java_lang_VMClass == NULL) {
-          FieldBlock *field;
-          java_lang_VMClass = findSystemClass0("java/lang/VMClass");
-	  if((field = findField(java_lang_VMClass, "clazz", "Ljava/lang/Class;")) == NULL)
-              goto init_error;
-	  clazz_offset = field->offset;
-    }
-
-    vmClass = allocObject(java_lang_VMClass);
-    INST_DATA(vmClass)[clazz_offset] = (u4) class;
-    INST_DATA(class)[vmClass_offset] = (u4) vmClass;
-
     return;
 
 init_error:
diff -uNr jamvm-1.1.3/src/natives.c /home/mark/src/jamvm-1.1.3/src/natives.c
--- jamvm-1.1.3/src/natives.c	2004-04-12 04:14:57.000000000 +0200
+++ /home/mark/src/jamvm-1.1.3/src/natives.c	2004-04-23 13:39:25.000000000 +0200
@@ -292,9 +292,7 @@
 
 /* java.lang.VMClass */
 
-extern int clazz_offset;
-
-#define GET_CLASS(vmClass) (Class*)(INST_DATA((Object*)vmClass)[clazz_offset])
+#define GET_CLASS(vmClass) (Class*)vmClass
 
 u4 *isInstance(Class *class, MethodBlock *mb, u4 *ostack) {
     Class *clazz = GET_CLASS(ostack[0]);
diff -uNr jamvm-1.1.3/lib/java/lang/VMRuntime.java /home/mark/src/jamvm-1.1.3/lib/java/lang/VMRuntime.java
--- jamvm-1.1.3/lib/java/lang/VMRuntime.java	2004-03-24 04:42:54.000000000 +0100
+++ /home/mark/src/jamvm-1.1.3/lib/java/lang/VMRuntime.java	2004-04-22 18:33:54.000000000 +0200
@@ -38,6 +38,7 @@
 package java.lang;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Properties;
 
 /**
@@ -178,8 +179,10 @@
      * @return the newly created process
      * @throws NullPointerException if cmd or env have null elements
      */
-    static Process exec(String[] cmd, String[] env, File dir) {
-        throw new InternalError("unimplemented");
+    static Process exec(String[] cmd, String[] env, File dir)
+      throws IOException
+    {
+        return VMProcess.exec(cmd, env, dir);
     }
 
     /**

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

_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to