changeset 22680:d79fcf097df7

Allow invocation plugin registry to be created with class name instead of java.lang.Class
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 22 Sep 2015 17:38:07 -0700
parents 152f2a7c46d8
children 5e4894c6a2f1
files graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Tue Sep 22 17:36:27 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Tue Sep 22 17:38:07 2015 -0700
@@ -28,6 +28,7 @@
 import java.util.*;
 import java.util.stream.*;
 
+import jdk.internal.jvmci.common.JVMCIError;
 import jdk.internal.jvmci.meta.*;
 
 import com.oracle.graal.graph.Node;
@@ -100,6 +101,23 @@
         }
 
         /**
+         * Creates an object for registering {@link InvocationPlugin}s for methods declared by a
+         * given class.
+         *
+         * @param plugins where to register the plugins
+         * @param declaringClassName the name of the class class declaring the methods for which
+         *            plugins will be registered via this object
+         */
+        public Registration(InvocationPlugins plugins, String declaringClassName) {
+            this.plugins = plugins;
+            try {
+                this.declaringClass = Class.forName(declaringClassName);
+            } catch (ClassNotFoundException ex) {
+                throw JVMCIError.shouldNotReachHere(ex);
+            }
+        }
+
+        /**
          * Configures this registration to allow or disallow overwriting of invocation plugins.
          */
         public Registration setAllowOverwrite(boolean allowOverwrite) {