diff options
author | Jeroen Frijters <jeroen@sumatra.nl> | 2005-07-26 09:10:31 +0000 |
---|---|---|
committer | Jeroen Frijters <jeroen@sumatra.nl> | 2005-07-26 09:10:31 +0000 |
commit | 0fef40994f49c259cb03a7bfa74ea8c83c04a030 (patch) | |
tree | 62831194f1bab89bf7da8567102c035372feceb5 | |
parent | 24c563c4fead3e4d0ebd7037fb7147a5d86c4f8b (diff) | |
download | classpath-0fef40994f49c259cb03a7bfa74ea8c83c04a030.tar.gz |
2005-07-26 Jeroen Frijters <jeroen@frijters.net>
* NEWS: Added comment about new VMProxy class.
* gnu/classpath/Configuration.java.in
(HAVE_NATIVE_GET_PROXY_CLASS): Removed.
(HAVE_NATIVE_GET_PROXY_DATA): Removed.
(HAVE_NATIVE_GENERATE_PROXY_CLASS): Removed.
* java/lang/reflect/Proxy.java
(getProxyClass): Changed to call VMProxy.
(getProxyClass0): Removed.
(getProxyData0): Removed.
(generateProxyClass0): Removed.
(ProxyData): Removed private modifier.
(POOL): Removed (was unused).
(INVOKESTATIC): Removed (was unused).
* vm/reference/java/lang/reflect/VMProxy.java: New file.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | gnu/classpath/Configuration.java.in | 27 | ||||
-rw-r--r-- | java/lang/reflect/Proxy.java | 85 | ||||
-rw-r--r-- | vm/reference/java/lang/reflect/VMProxy.java | 136 |
5 files changed, 161 insertions, 105 deletions
@@ -1,5 +1,22 @@ 2005-07-26 Jeroen Frijters <jeroen@frijters.net> + * NEWS: Added comment about new VMProxy class. + * gnu/classpath/Configuration.java.in + (HAVE_NATIVE_GET_PROXY_CLASS): Removed. + (HAVE_NATIVE_GET_PROXY_DATA): Removed. + (HAVE_NATIVE_GENERATE_PROXY_CLASS): Removed. + * java/lang/reflect/Proxy.java + (getProxyClass): Changed to call VMProxy. + (getProxyClass0): Removed. + (getProxyData0): Removed. + (generateProxyClass0): Removed. + (ProxyData): Removed private modifier. + (POOL): Removed (was unused). + (INVOKESTATIC): Removed (was unused). + * vm/reference/java/lang/reflect/VMProxy.java: New file. + +2005-07-26 Jeroen Frijters <jeroen@frijters.net> + * NEWS: Added comment about new VM hook in VMClassLoader. 2005-07-26 David Gilbert <david.gilbert@object-refinery.com> @@ -1,3 +1,4 @@ +* Moved native methods from java.lang.reflect.Proxy to VMProxy. * Added hook to VMClassLoader to allow VM to do class caching. * The Portable Object Adapter should support the output of the recent IDL to java compilers. These compilers now generate servants and diff --git a/gnu/classpath/Configuration.java.in b/gnu/classpath/Configuration.java.in index 9da4a820c..569ccf541 100644 --- a/gnu/classpath/Configuration.java.in +++ b/gnu/classpath/Configuration.java.in @@ -80,33 +80,6 @@ public interface Configuration boolean INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@; /** - * Set to true if the VM provides a native method to implement - * Proxy.getProxyClass completely, including argument verification. - * If this is true, HAVE_NATIVE_GET_PROXY_DATA and - * HAVE_NATIVE_GENERATE_PROXY_CLASS should be false. - * @see java.lang.reflect.Proxy - */ - boolean HAVE_NATIVE_GET_PROXY_CLASS = false; - - /** - * Set to true if the VM provides a native method to implement - * the first part of Proxy.getProxyClass: generation of the array - * of methods to convert, and verification of the arguments. - * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false. - * @see java.lang.reflect.Proxy - */ - boolean HAVE_NATIVE_GET_PROXY_DATA = false; - - /** - * Set to true if the VM provides a native method to implement - * the second part of Proxy.getProxyClass: conversion of an array of - * methods into an actual proxy class. - * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false. - * @see java.lang.reflect.Proxy - */ - boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false; - - /** * Name of default AWT peer library. */ String default_awt_peer_toolkit = "@default_toolkit@"; diff --git a/java/lang/reflect/Proxy.java b/java/lang/reflect/Proxy.java index dc1ac87e4..ad130a27b 100644 --- a/java/lang/reflect/Proxy.java +++ b/java/lang/reflect/Proxy.java @@ -38,7 +38,6 @@ exception statement from your version. */ package java.lang.reflect; -import gnu.classpath.Configuration; import gnu.java.lang.reflect.TypeSignature; import java.io.Serializable; @@ -263,16 +262,16 @@ public class Proxy implements Serializable Class clazz = (Class) proxyClasses.get(pt); if (clazz == null) { - if (Configuration.HAVE_NATIVE_GET_PROXY_CLASS) - clazz = getProxyClass0(loader, interfaces); + if (VMProxy.HAVE_NATIVE_GET_PROXY_CLASS) + clazz = VMProxy.getProxyClass(loader, interfaces); else { - ProxyData data = (Configuration.HAVE_NATIVE_GET_PROXY_DATA - ? getProxyData0(loader, interfaces) + ProxyData data = (VMProxy.HAVE_NATIVE_GET_PROXY_DATA + ? VMProxy.getProxyData(loader, interfaces) : ProxyData.getProxyData(pt)); - clazz = (Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS - ? generateProxyClass0(loader, data) + clazz = (VMProxy.HAVE_NATIVE_GENERATE_PROXY_CLASS + ? VMProxy.generateProxyClass(loader, data) : new ClassFactory(data).generate(loader)); } @@ -388,74 +387,6 @@ public class Proxy implements Serializable } /** - * Optional native method to replace (and speed up) the pure Java - * implementation of getProxyClass. Only needed if - * Configuration.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the - * work of both getProxyData0 and generateProxyClass0 with no - * intermediate form in Java. The native code may safely assume that - * this class must be created, and does not already exist. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param interfaces the interfaces the class will extend - * @return the generated proxy class - * @throws IllegalArgumentException if the constraints for getProxyClass - * were violated, except for problems with null - * @throws NullPointerException if `interfaces' is null or contains - * a null entry, or if handler is null - * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyData0(ClassLoader, Class[]) - * @see #generateProxyClass0(ProxyData) - */ - private static native Class getProxyClass0(ClassLoader loader, - Class[] interfaces); - - /** - * Optional native method to replace (and speed up) the pure Java - * implementation of getProxyData. Only needed if - * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code - * may safely assume that a new ProxyData object must be created which - * does not duplicate any existing ones. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param interfaces the interfaces the class will extend - * @return all data that is required to make this proxy class - * @throws IllegalArgumentException if the constraints for getProxyClass - * were violated, except for problems with null - * @throws NullPointerException if `interfaces' is null or contains - * a null entry, or if handler is null - * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyClass0(ClassLoader, Class[]) - * @see ProxyType#getProxyData() - */ - private static native ProxyData getProxyData0(ClassLoader loader, - Class[] interfaces); - - /** - * Optional native method to replace (and speed up) the pure Java - * implementation of generateProxyClass. Only needed if - * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native - * code may safely assume that a new Class must be created, and that - * the ProxyData object does not describe any existing class. - * - * @param loader the class loader to define the proxy class in; null - * implies the bootstrap class loader - * @param data the struct of information to convert to a Class. This - * has already been verified for all problems except exceeding - * VM limitations - * @return the newly generated class - * @throws IllegalArgumentException if VM limitations are exceeded - * @see #getProxyClass(ClassLoader, Class[]) - * @see #getProxyClass0(ClassLoader, Class[]) - * @see ProxyData#generateProxyClass(ClassLoader) - */ - private static native Class generateProxyClass0(ClassLoader loader, - ProxyData data); - - /** * Helper class for mapping unique ClassLoader and interface combinations * to proxy classes. * @@ -720,7 +651,7 @@ public class Proxy implements Serializable * * @author Eric Blake (ebb9@email.byu.edu) */ - private static final class ProxyData + static final class ProxyData { /** * The package this class is in <b>including the trailing dot</b> @@ -876,7 +807,6 @@ public class Proxy implements Serializable private static final class ClassFactory { /** Constants for assisting the compilation */ - private static final byte POOL = 0; private static final byte FIELD = 1; private static final byte METHOD = 2; private static final byte INTERFACE = 3; @@ -909,7 +839,6 @@ public class Proxy implements Serializable private static final char GETFIELD = 180; private static final char INVOKEVIRTUAL = 182; private static final char INVOKESPECIAL = 183; - private static final char INVOKESTATIC = 184; private static final char INVOKEINTERFACE = 185; private static final char NEW = 187; private static final char ANEWARRAY = 189; diff --git a/vm/reference/java/lang/reflect/VMProxy.java b/vm/reference/java/lang/reflect/VMProxy.java new file mode 100644 index 000000000..d3a2f17b7 --- /dev/null +++ b/vm/reference/java/lang/reflect/VMProxy.java @@ -0,0 +1,136 @@ +/* VMProxy.java -- VM interface for proxy class + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.lang.reflect; + +final class VMProxy +{ + /** + * Set to true if the VM provides a native method to implement + * Proxy.getProxyClass completely, including argument verification. + * If this is true, HAVE_NATIVE_GET_PROXY_DATA and + * HAVE_NATIVE_GENERATE_PROXY_CLASS should be false. + * @see java.lang.reflect.Proxy + */ + static boolean HAVE_NATIVE_GET_PROXY_CLASS = false; + + /** + * Set to true if the VM provides a native method to implement + * the first part of Proxy.getProxyClass: generation of the array + * of methods to convert, and verification of the arguments. + * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false. + * @see java.lang.reflect.Proxy + */ + static boolean HAVE_NATIVE_GET_PROXY_DATA = false; + + /** + * Set to true if the VM provides a native method to implement + * the second part of Proxy.getProxyClass: conversion of an array of + * methods into an actual proxy class. + * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false. + * @see java.lang.reflect.Proxy + */ + static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false; + + /** + * Optional native method to replace (and speed up) the pure Java + * implementation of getProxyClass. Only needed if + * VMProxy.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the + * work of both getProxyData and generateProxyClass with no + * intermediate form in Java. The native code may safely assume that + * this class must be created, and does not already exist. + * + * @param loader the class loader to define the proxy class in; null + * implies the bootstrap class loader + * @param interfaces the interfaces the class will extend + * @return the generated proxy class + * @throws IllegalArgumentException if the constraints for getProxyClass + * were violated, except for problems with null + * @throws NullPointerException if `interfaces' is null or contains + * a null entry, or if handler is null + * @see Configuration#HAVE_NATIVE_GET_PROXY_CLASS + * @see #getProxyClass(ClassLoader, Class[]) + * @see #getProxyData(ClassLoader, Class[]) + * @see #generateProxyClass(ProxyData) + */ + static native Class getProxyClass(ClassLoader loader, Class[] interfaces); + + /** + * Optional native method to replace (and speed up) the pure Java + * implementation of getProxyData. Only needed if + * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code + * may safely assume that a new ProxyData object must be created which + * does not duplicate any existing ones. + * + * @param loader the class loader to define the proxy class in; null + * implies the bootstrap class loader + * @param interfaces the interfaces the class will extend + * @return all data that is required to make this proxy class + * @throws IllegalArgumentException if the constraints for getProxyClass + * were violated, except for problems with null + * @throws NullPointerException if `interfaces' is null or contains + * a null entry, or if handler is null + * @see Configuration.HAVE_NATIVE_GET_PROXY_DATA + * @see #getProxyClass(ClassLoader, Class[]) + * @see #getProxyClass(ClassLoader, Class[]) + * @see ProxyType#getProxyData() + */ + static native Proxy.ProxyData getProxyData(ClassLoader loader, + Class[] interfaces); + + /** + * Optional native method to replace (and speed up) the pure Java + * implementation of generateProxyClass. Only needed if + * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native + * code may safely assume that a new Class must be created, and that + * the ProxyData object does not describe any existing class. + * + * @param loader the class loader to define the proxy class in; null + * implies the bootstrap class loader + * @param data the struct of information to convert to a Class. This + * has already been verified for all problems except exceeding + * VM limitations + * @return the newly generated class + * @throws IllegalArgumentException if VM limitations are exceeded + * @see #getProxyClass(ClassLoader, Class[]) + * @see #getProxyClass(ClassLoader, Class[]) + * @see ProxyData#generateProxyClass(ClassLoader) + */ + static native Class generateProxyClass(ClassLoader loader, + Proxy.ProxyData data); +} |