Hi,

I've attached a revision for the reflection classes that is applied to
Jikes RVM and has been updated for 0.98. This patch removes the messy
backlink mechanism in reflection and better supports eliminating
reflection overhead in Jikes RVM. Due to the problems it would cause
to VMs thought is needed before applying the patch.

Regards,
Ian

2009/2/9 Nicolas Geoffray <nicolas.geoff...@menlina.com>:
> Hi Andrew,
>
> Andrew John Hughes wrote:
>>
>> This updates NEWS with the VM updates in 0.98.
>>
>> 2009-02-05  Andrew John Hughes  <ahug...@redhat.com>
>>
>>        * NEWS: Add VM updates.
>>
>
> So I guess it's too late now, but forgot to talk about VMField, VMMethod and
> VMConstructor which I think are new in 0.98.
>
> Cheers,
> Nicolas
>
>
>
Index: java/lang/reflect/Constructor.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/reflect/Constructor.java,v
retrieving revision 1.10
diff -u -r1.10 Constructor.java
--- java/lang/reflect/Constructor.java	23 Jun 2008 20:59:35 -0000	1.10
+++ java/lang/reflect/Constructor.java	18 Aug 2008 17:14:28 -0000
@@ -95,7 +95,6 @@
   Constructor(VMConstructor cons)
   {
     this.cons = cons;
-    cons.cons = this;
   }
 
   private Constructor()
@@ -316,7 +315,7 @@
   {
     // Inescapable as the VM layer is 1.4 based. 
     @SuppressWarnings("unchecked")
-      T ins = (T) cons.construct(args);
+      T ins = (T) cons.construct(args, this);
     return ins;
   }
 
Index: java/lang/reflect/Field.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/reflect/Field.java,v
retrieving revision 1.10
diff -u -r1.10 Field.java
--- java/lang/reflect/Field.java	23 Jun 2008 20:59:35 -0000	1.10
+++ java/lang/reflect/Field.java	18 Aug 2008 17:14:28 -0000
@@ -96,7 +96,6 @@
   Field(VMField f)
   {
     this.f = f;
-    f.f = this;
   }
 
   /**
@@ -257,7 +256,7 @@
   public Object get(Object o)
     throws IllegalAccessException
   {
-    return f.get(o);
+    return f.get(this, o);
   }
 
   /**
@@ -280,7 +279,7 @@
   public boolean getBoolean(Object o)
     throws IllegalAccessException
   {
-    return f.getBoolean(o);
+    return f.getBoolean(this, o);
   }
 
   /**
@@ -303,7 +302,7 @@
   public byte getByte(Object o)
     throws IllegalAccessException
   {
-    return f.getByte(o);
+    return f.getByte(this, o);
   }
 
   /**
@@ -324,7 +323,7 @@
   public char getChar(Object o)
     throws IllegalAccessException
   {
-    return f.getChar(o);
+    return f.getChar(this, o);
   }
 
   /**
@@ -347,7 +346,7 @@
   public short getShort(Object o)
     throws IllegalAccessException
   {
-    return f.getShort(o);
+    return f.getShort(this, o);
   }
 
   /**
@@ -370,7 +369,7 @@
   public int getInt(Object o)
     throws IllegalAccessException
   {
-    return f.getInt(o);
+    return f.getInt(this, o);
   }
 
   /**
@@ -393,7 +392,7 @@
   public long getLong(Object o)
     throws IllegalAccessException
   {
-    return f.getLong(o);
+    return f.getLong(this, o);
   }
 
   /**
@@ -416,7 +415,7 @@
   public float getFloat(Object o)
     throws IllegalAccessException
   {
-    return f.getFloat(o);
+    return f.getFloat(this, o);
   }
 
   /**
@@ -440,7 +439,7 @@
   public double getDouble(Object o)
     throws IllegalAccessException
   {
-    return f.getDouble(o);
+    return f.getDouble(this, o);
   }
 
   /**
@@ -491,7 +490,7 @@
   public void set(Object o, Object value)
     throws IllegalAccessException
   {
-    f.set(o, value);
+    f.set(this, o, value);
   }
 
   /**
@@ -514,7 +513,7 @@
   public void setBoolean(Object o, boolean value)
     throws IllegalAccessException
   {
-    f.setBoolean(o, value);
+    f.setBoolean(this, o, value);
   }
 
   /**
@@ -537,7 +536,7 @@
   public void setByte(Object o, byte value)
     throws IllegalAccessException
   {
-    f.setByte(o, value);
+    f.setByte(this, o, value);
   }
 
   /**
@@ -560,7 +559,7 @@
   public void setChar(Object o, char value)
     throws IllegalAccessException
   {
-    f.setChar(o, value);
+    f.setChar(this, o, value);
   }
 
   /**
@@ -583,7 +582,7 @@
   public void setShort(Object o, short value)
     throws IllegalAccessException
   {
-    f.setShort(o, value);
+    f.setShort(this, o, value);
   }
 
   /**
@@ -606,7 +605,7 @@
   public void setInt(Object o, int value)
     throws IllegalAccessException
   {
-    f.setInt(o, value);
+    f.setInt(this, o, value);
   }
 
   /**
@@ -629,7 +628,7 @@
   public void setLong(Object o, long value)
     throws IllegalAccessException
   {
-    f.setLong(o, value);
+    f.setLong(this, o, value);
   }
 
   /**
@@ -652,7 +651,7 @@
   public void setFloat(Object o, float value)
     throws IllegalAccessException
   {
-    f.setFloat(o, value);
+    f.setFloat(this, o, value);
   }
 
   /**
@@ -675,7 +674,7 @@
   public void setDouble(Object o, double value)
     throws IllegalAccessException
   {
-    f.setDouble(o, value);
+    f.setDouble(this, o, value);
   }
 
   /**
Index: java/lang/reflect/Method.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/reflect/Method.java,v
retrieving revision 1.9
diff -u -r1.9 Method.java
--- java/lang/reflect/Method.java	23 Jun 2008 20:59:35 -0000	1.9
+++ java/lang/reflect/Method.java	18 Aug 2008 17:14:28 -0000
@@ -96,7 +96,6 @@
   Method(VMMethod m)
   {
     this.m = m;
-    m.m = this;
   }
 
   /**
@@ -324,7 +323,7 @@
   public Object invoke(Object o, Object... args)
     throws IllegalAccessException, InvocationTargetException
   {
-    return m.invoke(o, args);
+    return m.invoke(o, args, this);
   }
 
   /**
Index: vm/reference/java/lang/reflect/VMConstructor.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/java/lang/reflect/VMConstructor.java,v
retrieving revision 1.4
diff -u -r1.4 VMConstructor.java
--- vm/reference/java/lang/reflect/VMConstructor.java	6 Mar 2008 20:22:19 -0000	1.4
+++ vm/reference/java/lang/reflect/VMConstructor.java	18 Aug 2008 17:14:41 -0000
@@ -47,12 +47,6 @@
   Class clazz;
   int slot;
 
-  /** 
-   * This field allows us to refer back to the main constructor instance.
-   *  It is set by the constructor of Constructor.
-   */
-  Constructor cons;
-
   VMConstructor(Class clazz, int slot)
   {
     this.clazz = clazz;
@@ -88,7 +82,7 @@
    */
   native Class[] getExceptionTypes();
 
-  native Object construct(Object[] args)
+  native Object construct(Object[] args, Constructor cons)
     throws InstantiationException, IllegalAccessException,
     InvocationTargetException;
 
Index: vm/reference/java/lang/reflect/VMField.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/java/lang/reflect/VMField.java,v
retrieving revision 1.5
diff -u -r1.5 VMField.java
--- vm/reference/java/lang/reflect/VMField.java	16 Mar 2008 20:03:53 -0000	1.5
+++ vm/reference/java/lang/reflect/VMField.java	18 Aug 2008 17:14:42 -0000
@@ -46,12 +46,6 @@
   String name;
   int slot;
   
-  /** 
-   * This field allows us to refer back to the main constructor instance.
-   *  It is set by the constructor of Field.
-   */
-  Field f;
-
   VMField(Class clazz, String name, int slot)
   {
     this.clazz = clazz;
@@ -112,16 +106,16 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #getBoolean(Object)
-   * @see #getByte(Object)
-   * @see #getChar(Object)
-   * @see #getShort(Object)
-   * @see #getInt(Object)
-   * @see #getLong(Object)
-   * @see #getFloat(Object)
-   * @see #getDouble(Object)
+   * @see #getBoolean(Field f, Object)
+   * @see #getByte(Field f, Object)
+   * @see #getChar(Field f, Object)
+   * @see #getShort(Field f, Object)
+   * @see #getInt(Field f, Object)
+   * @see #getLong(Field f, Object)
+   * @see #getFloat(Field f, Object)
+   * @see #getDouble(Field f, Object)
    */
-  native Object get(Object o)
+  native Object get(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -139,9 +133,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native boolean getBoolean(Object o)
+  native boolean getBoolean(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -159,9 +153,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native byte getByte(Object o)
+  native byte getByte(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -178,9 +172,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native char getChar(Object o)
+  native char getChar(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -198,9 +192,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native short getShort(Object o)
+  native short getShort(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -218,9 +212,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native int getInt(Object o)
+  native int getInt(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -238,9 +232,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native long getLong(Object o)
+  native long getLong(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -258,9 +252,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native float getFloat(Object o)
+  native float getFloat(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -279,9 +273,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #get(Object)
+   * @see #get(Field f, Object)
    */
-  native double getDouble(Object o)
+  native double getDouble(Field f, Object o)
     throws IllegalAccessException;
 
   /**
@@ -320,16 +314,16 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #setBoolean(Object, boolean)
-   * @see #setByte(Object, byte)
-   * @see #setChar(Object, char)
-   * @see #setShort(Object, short)
-   * @see #setInt(Object, int)
-   * @see #setLong(Object, long)
-   * @see #setFloat(Object, float)
-   * @see #setDouble(Object, double)
+   * @see #setBoolean(Field f, Object, boolean)
+   * @see #setByte(Field f, Object, byte)
+   * @see #setChar(Field f, Object, char)
+   * @see #setShort(Field f, Object, short)
+   * @see #setInt(Field f, Object, int)
+   * @see #setLong(Field f, Object, long)
+   * @see #setFloat(Field f, Object, float)
+   * @see #setDouble(Field f, Object, double)
    */
-  native void set(Object o, Object value)
+  native void set(Field f, Object o, Object value)
     throws IllegalAccessException;
 
   /**
@@ -347,9 +341,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setBoolean(Object o, boolean value)
+  native void setBoolean(Field f, Object o, boolean value)
     throws IllegalAccessException;
 
   /**
@@ -367,9 +361,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setByte(Object o, byte value)
+  native void setByte(Field f, Object o, byte value)
     throws IllegalAccessException;
 
   /**
@@ -387,9 +381,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setChar(Object o, char value)
+  native void setChar(Field f, Object o, char value)
     throws IllegalAccessException;
 
   /**
@@ -407,9 +401,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setShort(Object o, short value)
+  native void setShort(Field f, Object o, short value)
     throws IllegalAccessException;
 
   /**
@@ -427,9 +421,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setInt(Object o, int value)
+  native void setInt(Field f, Object o, int value)
     throws IllegalAccessException;
 
   /**
@@ -447,9 +441,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setLong(Object o, long value)
+  native void setLong(Field f, Object o, long value)
     throws IllegalAccessException;
 
   /**
@@ -467,9 +461,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setFloat(Object o, float value)
+  native void setFloat(Field f, Object o, float value)
     throws IllegalAccessException;
 
   /**
@@ -487,9 +481,9 @@
    *         requires an instance
    * @throws ExceptionInInitializerError if accessing a static field triggered
    *         class initialization, which then failed
-   * @see #set(Object, Object)
+   * @see #set(Field f, Object, Object)
    */
-  native void setDouble(Object o, double value)
+  native void setDouble(Field f, Object o, double value)
     throws IllegalAccessException;
 
   /**
Index: vm/reference/java/lang/reflect/VMMethod.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/java/lang/reflect/VMMethod.java,v
retrieving revision 1.5
diff -u -r1.5 VMMethod.java
--- vm/reference/java/lang/reflect/VMMethod.java	16 Mar 2008 20:03:53 -0000	1.5
+++ vm/reference/java/lang/reflect/VMMethod.java	18 Aug 2008 17:14:42 -0000
@@ -48,12 +48,6 @@
   String name;
   int slot;
 
-  /** 
-   * This field allows us to refer back to the main constructor instance.
-   *  It is set by the constructor of Field.
-   */
-  Method m;
-
   public Class getDeclaringClass()
   {
     return clazz;
@@ -93,7 +87,7 @@
    */
   native Class[] getExceptionTypes();
 
-  native Object invoke(Object o, Object[] args)
+  native Object invoke(Object o, Object[] args, Method m)
     throws IllegalAccessException, InvocationTargetException;
 
   /**
[?1049h[?1h=[?12;25h[?12l[?25h[?25l"irog...@antigua:/home/antigua/IanR/classpath" [New DIRECTORY]~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            ~                                                                                                                                                            0,0-1All[?12l[?25h[?25l:[?12l[?25h [?25l0,0-1All[?12l[?25h[?25l:[?12l[?25hQ
[?25lE492: Not an editor command: Q0,0-1All[?12l[?25h[?25l:[?12l[?25hq!
[?25l[?1l>[?12l[?25h[?1049l3 files to edit

Reply via email to