changeset 20903:dc58f4ca21c9

generalized map in InvocationPlugins to MethodIdMap
author Doug Simon <doug.simon@oracle.com>
date Mon, 13 Apr 2015 21:50:37 +0200
parents 7cc48e7e6bfe
children 44d8f20d4f55
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/ForeignCallPlugin.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdHolder.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdMap.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodSubstitutionPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java
diffstat 13 files changed, 282 insertions(+), 184 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Mon Apr 13 21:50:37 2015 +0200
@@ -50,7 +50,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/ForeignCallPlugin.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/ForeignCallPlugin.java	Mon Apr 13 21:50:37 2015 +0200
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java	Mon Apr 13 21:50:37 2015 +0200
@@ -27,7 +27,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 
 /**
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -26,45 +26,19 @@
 
 import java.lang.reflect.*;
 import java.util.*;
-import java.util.function.*;
-import java.util.stream.*;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graph.Node;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.graphbuilderconf.MethodIdHolder.*;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.MethodKey;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.type.*;
 
 /**
  * Manages a set of {@link InvocationPlugin}s.
  */
 public class InvocationPlugins {
 
-    /**
-     * Access to the receiver in an {@link InvocationPlugin} for a non-static method. The class
-     * literal for this interface must be used with
-     * {@link InvocationPlugins#register(InvocationPlugin, Class, String, Class...)} to denote the
-     * receiver argument for such a non-static method.
-     */
-    public interface Receiver {
-        /**
-         * Gets the receiver value, null checking it first if necessary.
-         *
-         * @return the receiver value with a {@linkplain StampTool#isPointerNonNull(ValueNode)
-         *         non-null} stamp
-         */
-        ValueNode get();
-
-        /**
-         * Determines if the receiver is constant.
-         */
-        default boolean isConstant() {
-            return false;
-        }
-    }
-
     public static class InvocationPluginReceiver implements Receiver {
         private final GraphBuilderContext parser;
         private ValueNode[] args;
@@ -197,101 +171,16 @@
         }
     }
 
-    static final class MethodInfo {
-        final boolean isStatic;
-        final Class<?> declaringClass;
-        final String name;
-        final Class<?>[] argumentTypes;
-        final InvocationPlugin plugin;
-
-        int id;
-
-        MethodInfo(InvocationPlugin plugin, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-            this.plugin = plugin;
-            this.isStatic = argumentTypes.length == 0 || argumentTypes[0] != Receiver.class;
-            this.declaringClass = declaringClass;
-            this.name = name;
-            this.argumentTypes = argumentTypes;
-            if (!isStatic) {
-                argumentTypes[0] = declaringClass;
-            }
-            assert resolveJava() != null;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof MethodInfo) {
-                MethodInfo that = (MethodInfo) obj;
-                boolean res = this.name.equals(that.name) && this.declaringClass.equals(that.declaringClass) && Arrays.equals(this.argumentTypes, that.argumentTypes);
-                assert !res || this.isStatic == that.isStatic;
-                return res;
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            // Replay compilation mandates use of stable hash codes
-            return declaringClass.getName().hashCode() ^ name.hashCode();
-        }
-
-        ResolvedJavaMethod resolve(MetaAccessProvider metaAccess) {
-            return metaAccess.lookupJavaMethod(resolveJava());
-        }
-
-        Executable resolveJava() {
-            try {
-                Executable res;
-                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
-                if (name.equals("<init>")) {
-                    res = declaringClass.getDeclaredConstructor(parameterTypes);
-                } else {
-                    res = declaringClass.getDeclaredMethod(name, parameterTypes);
-                }
-                assert Modifier.isStatic(res.getModifiers()) == isStatic;
-                return res;
-            } catch (NoSuchMethodException | SecurityException e) {
-                throw new GraalInternalError(e);
-            }
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder(declaringClass.getName()).append('.').append(name).append('(');
-            for (Class<?> p : argumentTypes) {
-                if (sb.charAt(sb.length() - 1) != '(') {
-                    sb.append(", ");
-                }
-                sb.append(p.getSimpleName());
-            }
-            return sb.append(')').toString();
-        }
-    }
-
-    protected final MetaAccessProvider metaAccess;
-    private final List<MethodInfo> registrations;
-
-    /**
-     * The minimum {@linkplain MethodIdHolder#getMethodId() id} for a method associated with a
-     * plugin in {@link #plugins}.
-     */
-    private int minId = Integer.MAX_VALUE;
-
-    /**
-     * Resolved methods to plugins map. The keys (i.e., indexes) are derived from
-     * {@link MethodIdHolder#getMethodId()}.
-     */
-    private volatile InvocationPlugin[] plugins;
+    protected final MethodIdMap<InvocationPlugin> plugins;
 
     /**
      * The plugins {@linkplain #lookupInvocation(ResolvedJavaMethod) searched} before searching in
      * this object.
      */
-    private InvocationPlugins parent;
+    protected final InvocationPlugins parent;
 
     private InvocationPlugins(InvocationPlugins parent, MetaAccessProvider metaAccess) {
-        this.metaAccess = metaAccess;
-        this.registrations = new ArrayList<>(INITIAL_PLUGIN_CAPACITY);
+        this.plugins = new MethodIdMap<>(metaAccess);
         InvocationPlugins p = parent;
         // Only adopt a non-empty parent
         while (p != null && p.size() == 0) {
@@ -300,13 +189,11 @@
         this.parent = p;
     }
 
-    private static final int INITIAL_PLUGIN_CAPACITY = 64;
-
     /**
      * Creates a set of invocation plugins with a non-null {@linkplain #getParent() parent}.
      */
     public InvocationPlugins(InvocationPlugins parent) {
-        this(parent, parent.metaAccess);
+        this(parent, parent.plugins.getMetaAccess());
     }
 
     public InvocationPlugins(MetaAccessProvider metaAccess) {
@@ -318,10 +205,8 @@
      * registered for {@code method}.
      */
     public void register(InvocationPlugin plugin, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-        MethodInfo methodInfo = new MethodInfo(plugin, declaringClass, name, argumentTypes);
+        MethodKey<InvocationPlugin> methodInfo = plugins.put(plugin, declaringClass, name, argumentTypes);
         assert Checker.check(this, methodInfo, plugin);
-        assert plugins == null : "invocation plugin registration is closed";
-        registrations.add(methodInfo);
     }
 
     /**
@@ -338,44 +223,7 @@
                 return plugin;
             }
         }
-        MethodIdHolder pluggable = (MethodIdHolder) method;
-        if (plugins == null) {
-            // 'assignIds' synchronizes on a global lock which ensures thread safe
-            // allocation of identifiers across all InvocationPlugins objects
-            MethodIdHolder.assignIds(new Consumer<MethodIdAllocator>() {
-                public void accept(MethodIdAllocator idAllocator) {
-                    if (plugins == null) {
-                        if (registrations.isEmpty()) {
-                            plugins = new InvocationPlugin[0];
-                        } else {
-                            int max = Integer.MIN_VALUE;
-                            for (MethodInfo methodInfo : registrations) {
-                                MethodIdHolder p = (MethodIdHolder) methodInfo.resolve(metaAccess);
-                                int id = idAllocator.assignId(p);
-                                if (id < minId) {
-                                    minId = id;
-                                }
-                                if (id > max) {
-                                    max = id;
-                                }
-                                methodInfo.id = id;
-                            }
-
-                            int length = (max - minId) + 1;
-                            plugins = new InvocationPlugin[length];
-                            for (MethodInfo m : registrations) {
-                                int index = m.id - minId;
-                                plugins[index] = m.plugin;
-                            }
-                        }
-                    }
-                }
-            });
-        }
-
-        int id = pluggable.getMethodId();
-        int index = id - minId;
-        return index >= 0 && index < plugins.length ? plugins[index] : null;
+        return plugins.get((MethodIdHolder) method);
     }
 
     /**
@@ -388,7 +236,7 @@
 
     @Override
     public String toString() {
-        return registrations.stream().map(MethodInfo::toString).collect(Collectors.joining(", ")) + " / parent: " + this.parent;
+        return plugins + " / parent: " + this.parent;
     }
 
     private static class Checker {
@@ -417,10 +265,10 @@
             SIGS = sigs.toArray(new Class<?>[sigs.size()][]);
         }
 
-        public static boolean check(InvocationPlugins plugins, MethodInfo method, InvocationPlugin plugin) {
-            InvocationPlugins p = plugins;
+        public static boolean check(InvocationPlugins plugins, MethodKey<InvocationPlugin> method, InvocationPlugin plugin) {
+            InvocationPlugins p = plugins.parent;
             while (p != null) {
-                assert !p.registrations.contains(method) : "a plugin is already registered for " + method;
+                assert !p.plugins.containsKey(method) : "a plugin is already registered for " + method;
                 p = p.parent;
             }
             if (plugin instanceof ForeignCallPlugin) {
@@ -445,12 +293,8 @@
         }
     }
 
-    public MetaAccessProvider getMetaAccess() {
-        return metaAccess;
-    }
-
     public int size() {
-        return registrations.size();
+        return plugins.size();
     }
 
     /**
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdHolder.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdHolder.java	Mon Apr 13 21:50:37 2015 +0200
@@ -29,7 +29,7 @@
 
 /**
  * {@link ResolvedJavaMethod}s that can be assigned a globally unique identifier for use as keys in
- * an array based map. This should only be used where the cost of a {@link Map} with
+ * a {@link MethodIdMap}. This should only be used where the cost of a {@link Map} with
  * {@link ResolvedJavaMethod}s as keys is too high.
  */
 public interface MethodIdHolder extends ResolvedJavaMethod {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdMap.java	Mon Apr 13 21:50:37 2015 +0200
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.graphbuilderconf;
+
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.graphbuilderconf.MethodIdHolder.MethodIdAllocator;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.type.*;
+
+/**
+ * A map whose keys are {@link MethodIdHolder}s that doesn't require eager resolution of
+ * {@link ResolvedJavaMethod}s and has retrieval as fast as array indexing. The constraints on using
+ * such a map are:
+ * <ul>
+ * <li>at most one value can be added for any key</li>
+ * <li>no more entries can be added after the first {@linkplain #get(MethodIdHolder) retrieval}</li>
+ * </ul>
+ *
+ * @param <V> the type of the values in the map
+ */
+public class MethodIdMap<V> {
+
+    /**
+     * The receiver in a non-static method. The class literal for this interface must be used with
+     * {@link MethodIdMap#put(Object, Class, String, Class...)} to denote the receiver argument for
+     * such a non-static method.
+     */
+    public interface Receiver {
+        /**
+         * Gets the receiver value, null checking it first if necessary.
+         *
+         * @return the receiver value with a {@linkplain StampTool#isPointerNonNull(ValueNode)
+         *         non-null} stamp
+         */
+        ValueNode get();
+
+        /**
+         * Determines if the receiver is constant.
+         */
+        default boolean isConstant() {
+            return false;
+        }
+    }
+
+    /**
+     * Key for a method.
+     */
+    public static class MethodKey<T> {
+        final boolean isStatic;
+        final Class<?> declaringClass;
+        final String name;
+        final Class<?>[] argumentTypes;
+        final T value;
+        int id;
+
+        MethodKey(T data, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+            this.value = data;
+            this.isStatic = argumentTypes.length == 0 || argumentTypes[0] != Receiver.class;
+            this.declaringClass = declaringClass;
+            this.name = name;
+            this.argumentTypes = argumentTypes;
+            if (!isStatic) {
+                argumentTypes[0] = declaringClass;
+            }
+            assert resolveJava() != null;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof MethodKey) {
+                MethodKey<?> that = (MethodKey<?>) obj;
+                boolean res = this.name.equals(that.name) && this.declaringClass.equals(that.declaringClass) && Arrays.equals(this.argumentTypes, that.argumentTypes);
+                assert !res || this.isStatic == that.isStatic;
+                return res;
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            // Replay compilation mandates use of stable hash codes
+            return declaringClass.getName().hashCode() ^ name.hashCode();
+        }
+
+        private MethodIdHolder resolve(MetaAccessProvider metaAccess) {
+            return (MethodIdHolder) metaAccess.lookupJavaMethod(resolveJava());
+        }
+
+        private Executable resolveJava() {
+            try {
+                Executable res;
+                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
+                if (name.equals("<init>")) {
+                    res = declaringClass.getDeclaredConstructor(parameterTypes);
+                } else {
+                    res = declaringClass.getDeclaredMethod(name, parameterTypes);
+                }
+                assert Modifier.isStatic(res.getModifiers()) == isStatic;
+                return res;
+            } catch (NoSuchMethodException | SecurityException e) {
+                throw new GraalInternalError(e);
+            }
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder(declaringClass.getName()).append('.').append(name).append('(');
+            for (Class<?> p : argumentTypes) {
+                if (sb.charAt(sb.length() - 1) != '(') {
+                    sb.append(", ");
+                }
+                sb.append(p.getSimpleName());
+            }
+            return sb.append(')').toString();
+        }
+    }
+
+    private final MetaAccessProvider metaAccess;
+
+    /**
+     * Initial list of entries.
+     */
+    private final List<MethodKey<V>> registrations;
+
+    /**
+     * Entry array that is initialized upon first call to {@link #get(MethodIdHolder)}.
+     *
+     * Note: this must be volatile since double-checked locking is used to initialize it
+     */
+    private volatile V[] entries;
+
+    /**
+     * The minimum {@linkplain MethodIdHolder#getMethodId() id} for a key in this map.
+     */
+    private int minId = Integer.MAX_VALUE;
+
+    public MethodIdMap(MetaAccessProvider metaAccess) {
+        this.metaAccess = metaAccess;
+        this.registrations = new ArrayList<>(INITIAL_CAPACITY);
+    }
+
+    private static final int INITIAL_CAPACITY = 64;
+
+    /**
+     * Adds an entry to this map for a specified method.
+     *
+     * @param value value to be associated with the specified method
+     * @param declaringClass the class declaring the method
+     * @param name the name of the method
+     * @param argumentTypes the argument types of the method. Element 0 of this array must be the
+     *            {@link Class} value for {@link Receiver} iff the method is non-static.
+     * @return an object representing the method
+     */
+    public MethodKey<V> put(V value, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+        MethodKey<V> methodKey = new MethodKey<>(value, declaringClass, name, argumentTypes);
+        assert entries == null : "registration is closed";
+        assert !registrations.contains(methodKey) : "a value is already registered for " + methodKey;
+        registrations.add(methodKey);
+        return methodKey;
+    }
+
+    @SuppressWarnings("unchecked")
+    protected V[] allocateEntries(int length) {
+        return (V[]) new Object[length];
+    }
+
+    /**
+     * Determines if a method denoted by a given {@link MethodKey} is in this map.
+     */
+    public boolean containsKey(MethodKey<V> key) {
+        return registrations.contains(key);
+    }
+
+    public V get(MethodIdHolder method) {
+        if (entries == null) {
+            // 'assignIds' synchronizes on a global lock which ensures thread safe
+            // allocation of identifiers across all MethodIdHolder objects
+            MethodIdHolder.assignIds(new Consumer<MethodIdAllocator>() {
+
+                public void accept(MethodIdAllocator idAllocator) {
+                    if (entries == null) {
+                        if (registrations.isEmpty()) {
+                            entries = allocateEntries(0);
+                        } else {
+                            int max = Integer.MIN_VALUE;
+                            for (MethodKey<V> methodKey : registrations) {
+                                MethodIdHolder m = methodKey.resolve(metaAccess);
+                                int id = idAllocator.assignId(m);
+                                if (id < minId) {
+                                    minId = id;
+                                }
+                                if (id > max) {
+                                    max = id;
+                                }
+                                methodKey.id = id;
+                            }
+
+                            int length = (max - minId) + 1;
+                            entries = allocateEntries(length);
+                            for (MethodKey<V> m : registrations) {
+                                int index = m.id - minId;
+                                entries[index] = m.value;
+                            }
+                        }
+                    }
+                }
+            });
+        }
+
+        int id = method.getMethodId();
+        int index = id - minId;
+        return index >= 0 && index < entries.length ? entries[index] : null;
+    }
+
+    @Override
+    public String toString() {
+        return registrations.stream().map(MethodKey::toString).collect(Collectors.joining(", "));
+    }
+
+    public MetaAccessProvider getMetaAccess() {
+        return metaAccess;
+    }
+
+    public int size() {
+        return registrations.size();
+    }
+}
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodSubstitutionPlugin.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodSubstitutionPlugin.java	Mon Apr 13 21:50:37 2015 +0200
@@ -30,7 +30,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 
 /**
@@ -121,8 +121,8 @@
                 return m;
             }
         }
-        throw new GraalInternalError("No method found in %s compatible with the signature (%s)", declaringClass.getName(), Arrays.asList(parameters).stream().map(c -> c.getSimpleName()).collect(
-                        Collectors.joining(",")));
+        throw new GraalInternalError("No method found in %s compatible with \"%s(%s)\"", declaringClass.getName(), name, Arrays.asList(parameters).stream().map(c -> c.getSimpleName()).collect(
+                        Collectors.joining(", ")));
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -34,8 +34,8 @@
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.ClassQueryNode.Query;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -33,6 +33,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.hotspot.replacements.*;
@@ -77,7 +78,7 @@
     @Override
     public InvocationPlugin lookupInvocation(ResolvedJavaMethod method) {
         if (methodHandleClass == null) {
-            methodHandleClass = metaAccess.lookupJavaType(MethodHandle.class);
+            methodHandleClass = plugins.getMetaAccess().lookupJavaType(MethodHandle.class);
         }
         if (method.getDeclaringClass().equals(methodHandleClass)) {
             HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -29,10 +29,10 @@
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.replacements.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Mon Apr 13 21:50:37 2015 +0200
@@ -27,7 +27,7 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -38,8 +38,8 @@
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.debug.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Fri Apr 10 16:29:48 2015 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Mon Apr 13 21:50:37 2015 +0200
@@ -32,8 +32,8 @@
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.InvocationPlugins.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
+import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;