changeset 19883:4d33cd6e0c8f

refactored GraphBuilderConfiguration (and its component classes) into a separate project
author Doug Simon <doug.simon@oracle.com>
date Sun, 15 Mar 2015 11:36:54 +0100
parents 0c29075aeafe
children 87736c089259
files graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderConfiguration.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderPlugin.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.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/HotSpotInlineInvokePlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadFieldPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadIndexedPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java graal/com.oracle.graal.java/src/com/oracle/graal/java/DefaultSuitesProvider.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPlugin.java graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ConstantBindingParameterPlugin.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ExactMathTest.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java mx/suite.py
diffstat 41 files changed, 1061 insertions(+), 1053 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Sun Mar 15 11:36:54 2015 +0100
@@ -41,8 +41,9 @@
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java	Sun Mar 15 11:36:54 2015 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.api.meta.Assumptions.Assumption;
 import com.oracle.graal.api.meta.Assumptions.NoFinalizableSubclass;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Sun Mar 15 11:36:54 2015 +0100
@@ -48,8 +48,9 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodeinfo.*;
@@ -62,7 +63,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
-import com.oracle.graal.phases.schedule.SchedulePhase.*;
+import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.printer.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Sun Mar 15 11:36:54 2015 +0100
@@ -34,7 +34,7 @@
 import com.oracle.graal.api.code.CompilationResult.Call;
 import com.oracle.graal.api.code.CompilationResult.Infopoint;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.java.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Sun Mar 15 11:36:54 2015 +0100
@@ -30,7 +30,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.java.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java	Sun Mar 15 11:36:54 2015 +0100
@@ -29,8 +29,9 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderConfiguration.java	Sun Mar 15 11:36:54 2015 +0100
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2011, 2013, 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.util.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.nodes.*;
+
+public class GraphBuilderConfiguration {
+
+    public static class Plugins {
+        private final InvocationPlugins invocationPlugins;
+        private LoadFieldPlugin loadFieldPlugin;
+        private LoadIndexedPlugin loadIndexedPlugin;
+        private ParameterPlugin parameterPlugin;
+        private InlineInvokePlugin inlineInvokePlugin;
+        private GenericInvocationPlugin genericInvocationPlugin;
+        private LoopExplosionPlugin loopExplosionPlugin;
+
+        /**
+         * Creates a copy of a given set of plugins. The {@link InvocationPlugins} in
+         * {@code copyFrom} become the {@linkplain InvocationPlugins#getDefaults() default}
+         * {@linkplain #getInvocationPlugins() invocation plugins} in this object.
+         */
+        public Plugins(Plugins copyFrom) {
+            this.invocationPlugins = new InvocationPlugins(copyFrom.invocationPlugins);
+            this.parameterPlugin = copyFrom.parameterPlugin;
+            this.loadFieldPlugin = copyFrom.loadFieldPlugin;
+            this.loadIndexedPlugin = copyFrom.loadIndexedPlugin;
+            this.inlineInvokePlugin = copyFrom.inlineInvokePlugin;
+            this.loopExplosionPlugin = copyFrom.loopExplosionPlugin;
+            this.genericInvocationPlugin = copyFrom.genericInvocationPlugin;
+        }
+
+        /**
+         * Creates a new set of plugins.
+         *
+         * @param invocationPlugins the {@linkplain #getInvocationPlugins() invocation plugins} in
+         *            this object
+         */
+        public Plugins(InvocationPlugins invocationPlugins) {
+            this.invocationPlugins = invocationPlugins;
+        }
+
+        public InvocationPlugins getInvocationPlugins() {
+            return invocationPlugins;
+        }
+
+        public GenericInvocationPlugin getGenericInvocationPlugin() {
+            return genericInvocationPlugin;
+        }
+
+        public void setGenericInvocationPlugin(GenericInvocationPlugin plugin) {
+            this.genericInvocationPlugin = plugin;
+        }
+
+        public LoadFieldPlugin getLoadFieldPlugin() {
+            return loadFieldPlugin;
+        }
+
+        public void setLoadFieldPlugin(LoadFieldPlugin plugin) {
+            this.loadFieldPlugin = plugin;
+        }
+
+        public LoadIndexedPlugin getLoadIndexedPlugin() {
+            return loadIndexedPlugin;
+        }
+
+        public void setLoadIndexedPlugin(LoadIndexedPlugin plugin) {
+            this.loadIndexedPlugin = plugin;
+        }
+
+        public ParameterPlugin getParameterPlugin() {
+            return parameterPlugin;
+        }
+
+        public void setParameterPlugin(ParameterPlugin plugin) {
+            this.parameterPlugin = plugin;
+        }
+
+        public InlineInvokePlugin getInlineInvokePlugin() {
+            return inlineInvokePlugin;
+        }
+
+        public void setInlineInvokePlugin(InlineInvokePlugin plugin) {
+            this.inlineInvokePlugin = plugin;
+        }
+
+        public LoopExplosionPlugin getLoopExplosionPlugin() {
+            return loopExplosionPlugin;
+        }
+
+        public void setLoopExplosionPlugin(LoopExplosionPlugin plugin) {
+            this.loopExplosionPlugin = plugin;
+        }
+    }
+
+    private static final ResolvedJavaType[] EMPTY = new ResolvedJavaType[]{};
+
+    private final boolean eagerResolving;
+    private final boolean omitAllExceptionEdges;
+    private final ResolvedJavaType[] skippedExceptionTypes;
+    private final DebugInfoMode debugInfoMode;
+    private final boolean doLivenessAnalysis;
+    private boolean useProfiling;
+    private final Plugins plugins;
+
+    public static enum DebugInfoMode {
+        SafePointsOnly,
+        /**
+         * This mode inserts {@link SimpleInfopointNode}s in places where no safepoints would be
+         * inserted: inlining boundaries, and line number switches.
+         * <p>
+         * In this mode the infopoint only have a location (method and bytecode index) and no
+         * values.
+         * <p>
+         * This is useful to have better program counter to bci mapping and has no influence on the
+         * generated code. However it can increase the amount of metadata and does not allow access
+         * to accessing values at runtime.
+         */
+        Simple,
+        /**
+         * In this mode, {@link FullInfopointNode}s are generated in the same locations as in
+         * {@link #Simple} mode but the infopoints have access to the runtime values.
+         * <p>
+         * This is relevant when code is to be generated for native, machine-code level debugging
+         * but can have a limit the amount of optimization applied to the code.
+         */
+        Full,
+    }
+
+    protected GraphBuilderConfiguration(boolean eagerResolving, boolean omitAllExceptionEdges, DebugInfoMode debugInfoMode, ResolvedJavaType[] skippedExceptionTypes, boolean doLivenessAnalysis,
+                    Plugins plugins) {
+        this.eagerResolving = eagerResolving;
+        this.omitAllExceptionEdges = omitAllExceptionEdges;
+        this.debugInfoMode = debugInfoMode;
+        this.skippedExceptionTypes = skippedExceptionTypes;
+        this.doLivenessAnalysis = doLivenessAnalysis;
+        this.useProfiling = true;
+        this.plugins = plugins;
+    }
+
+    /**
+     * Creates a copy of this configuration with all its plugins. The {@link InvocationPlugins} in
+     * this configuration become the {@linkplain InvocationPlugins#getDefaults defaults} of the
+     * {@link InvocationPlugins} in the copy.
+     */
+    public GraphBuilderConfiguration copy() {
+        Plugins newPlugins = new Plugins(new InvocationPlugins(plugins.getInvocationPlugins()));
+        GraphBuilderConfiguration result = new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, doLivenessAnalysis, newPlugins);
+        result.useProfiling = useProfiling;
+        return result;
+    }
+
+    public boolean getUseProfiling() {
+        return useProfiling;
+    }
+
+    public void setUseProfiling(boolean b) {
+        this.useProfiling = b;
+    }
+
+    public GraphBuilderConfiguration withSkippedExceptionTypes(ResolvedJavaType[] newSkippedExceptionTypes) {
+        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, newSkippedExceptionTypes, doLivenessAnalysis, plugins);
+    }
+
+    public GraphBuilderConfiguration withOmitAllExceptionEdges(boolean newOmitAllExceptionEdges) {
+        return new GraphBuilderConfiguration(eagerResolving, newOmitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, doLivenessAnalysis, plugins);
+    }
+
+    public GraphBuilderConfiguration withDebugInfoMode(DebugInfoMode newDebugInfoMode) {
+        ResolvedJavaType[] newSkippedExceptionTypes = skippedExceptionTypes == EMPTY ? EMPTY : Arrays.copyOf(skippedExceptionTypes, skippedExceptionTypes.length);
+        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, newDebugInfoMode, newSkippedExceptionTypes, doLivenessAnalysis, plugins);
+    }
+
+    public GraphBuilderConfiguration withDoLivenessAnalysis(boolean newLivenessAnalysis) {
+        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, newLivenessAnalysis, plugins);
+    }
+
+    public ResolvedJavaType[] getSkippedExceptionTypes() {
+        return skippedExceptionTypes;
+    }
+
+    public boolean eagerResolving() {
+        return eagerResolving;
+    }
+
+    public boolean omitAllExceptionEdges() {
+        return omitAllExceptionEdges;
+    }
+
+    public boolean insertNonSafepointDebugInfo() {
+        return debugInfoMode.ordinal() >= DebugInfoMode.Simple.ordinal();
+    }
+
+    public boolean insertFullDebugInfo() {
+        return debugInfoMode.ordinal() >= DebugInfoMode.Full.ordinal();
+    }
+
+    public boolean doLivenessAnalysis() {
+        return doLivenessAnalysis;
+    }
+
+    public static GraphBuilderConfiguration getDefault(Plugins plugins) {
+        return new GraphBuilderConfiguration(false, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
+    }
+
+    public static GraphBuilderConfiguration getEagerDefault(Plugins plugins) {
+        return new GraphBuilderConfiguration(true, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
+    }
+
+    public static GraphBuilderConfiguration getSnippetDefault(Plugins plugins) {
+        return new GraphBuilderConfiguration(true, true, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
+    }
+
+    public static GraphBuilderConfiguration getFullDebugDefault(Plugins plugins) {
+        return new GraphBuilderConfiguration(true, false, DebugInfoMode.Full, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
+    }
+
+    /**
+     * Returns {@code true} if it is an error for a class/field/method resolution to fail. The
+     * default is the same result as returned by {@link #eagerResolving()}. However, it may be
+     * overridden to allow failure even when {@link #eagerResolving} is {@code true}.
+     */
+    public boolean unresolvedIsError() {
+        return eagerResolving;
+    }
+
+    public Plugins getPlugins() {
+        return plugins;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java	Sun Mar 15 11:36:54 2015 +0100
@@ -0,0 +1,138 @@
+/*
+ * 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 com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.spi.*;
+
+/**
+ * Used by a {@link GraphBuilderPlugin} to interface with a graph builder object.
+ */
+public interface GraphBuilderContext {
+
+    /**
+     * Information about a snippet or method substitution currently being processed by the graph
+     * builder.
+     */
+    public interface Replacement {
+
+        /**
+         * Gets the method being replaced.
+         */
+        ResolvedJavaMethod getOriginalMethod();
+
+        /**
+         * Gets the replacement method.
+         */
+        ResolvedJavaMethod getReplacementMethod();
+
+        /**
+         * Determines if this replacement is being inlined as a compiler intrinsic. A compiler
+         * intrinsic is atomic with respect to deoptimization. Deoptimization within a compiler
+         * intrinsic will restart the interpreter at the intrinsified call.
+         */
+        boolean isIntrinsic();
+    }
+
+    <T extends ControlSinkNode> T append(T fixed);
+
+    <T extends ControlSplitNode> T append(T fixed);
+
+    <T extends FixedWithNextNode> T append(T fixed);
+
+    <T extends FloatingNode> T append(T value);
+
+    <T extends ValueNode> T append(T value);
+
+    StampProvider getStampProvider();
+
+    MetaAccessProvider getMetaAccess();
+
+    Assumptions getAssumptions();
+
+    ConstantReflectionProvider getConstantReflection();
+
+    SnippetReflectionProvider getSnippetReflection();
+
+    void push(Kind kind, ValueNode value);
+
+    StructuredGraph getGraph();
+
+    /**
+     * Gets the parsing context for the method that inlines the method being parsed by this context.
+     */
+    GraphBuilderContext getParent();
+
+    /**
+     * Gets the root method for the graph building process.
+     */
+    ResolvedJavaMethod getRootMethod();
+
+    /**
+     * Gets the method currently being parsed.
+     */
+    ResolvedJavaMethod getMethod();
+
+    /**
+     * Gets the index of the bytecode instruction currently being parsed.
+     */
+    int bci();
+
+    /**
+     * Gets the inline depth of this context. 0 implies this is the context for the
+     * {@linkplain #getRootMethod() root method}.
+     */
+    int getDepth();
+
+    /**
+     * Determines if the current parsing context is a snippet or method substitution.
+     */
+    default boolean parsingReplacement() {
+        return getReplacement() == null;
+    }
+
+    /**
+     * Gets the replacement of the current parsing context or {@code null} if not
+     * {@link #parsingReplacement() parsing a replacement}.
+     */
+    Replacement getReplacement();
+
+    /**
+     * @see GuardingPiNode#nullCheckedValue(ValueNode)
+     */
+    static ValueNode nullCheckedValue(GraphBuilderContext builder, ValueNode value) {
+        ValueNode nonNullValue = GuardingPiNode.nullCheckedValue(value);
+        if (nonNullValue != value) {
+            builder.append((FixedWithNextNode) nonNullValue);
+        }
+        return nonNullValue;
+    }
+
+    boolean eagerResolving();
+
+    BailoutException bailout(String string);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -0,0 +1,246 @@
+/*
+ * 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 com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.calc.*;
+
+/**
+ * Marker interface for graph builder plugins.
+ */
+public interface GraphBuilderPlugin {
+
+    public interface LoadFieldPlugin extends GraphBuilderPlugin {
+        @SuppressWarnings("unused")
+        default boolean apply(GraphBuilderContext b, ValueNode receiver, ResolvedJavaField field) {
+            return false;
+        }
+
+        @SuppressWarnings("unused")
+        default boolean apply(GraphBuilderContext graphBuilderContext, ResolvedJavaField staticField) {
+            return false;
+        }
+
+        default boolean tryConstantFold(GraphBuilderContext b, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ResolvedJavaField field, JavaConstant receiver) {
+            JavaConstant result = constantReflection.readConstantFieldValue(field, receiver);
+            if (result != null) {
+                ConstantNode constantNode = b.append(ConstantNode.forConstant(result, metaAccess));
+                b.push(constantNode.getKind().getStackKind(), constantNode);
+                return true;
+            }
+            return false;
+        }
+    }
+
+    public interface LoadIndexedPlugin extends GraphBuilderPlugin {
+        @SuppressWarnings("unused")
+        default boolean apply(GraphBuilderContext b, ValueNode array, ValueNode index, Kind elementKind) {
+            return false;
+        }
+    }
+
+    /**
+     * Plugin for specifying what is inlined during graph parsing or for post-processing non-inlined
+     * invocations that result in {@link Invoke} nodes.
+     */
+    public interface InlineInvokePlugin extends GraphBuilderPlugin {
+
+        public static class InlineInfo {
+
+            /**
+             * The method to be inlined. If this is not equal to the {@code method} argument passed
+             * to {@link InlineInvokePlugin#getClass()}, the graph builder context interprets it as
+             * a {@linkplain GraphBuilderContext.Replacement replacement}.
+             */
+            public final ResolvedJavaMethod methodToInline;
+
+            /**
+             * Specifies if {@link #methodToInline} is an intrinsic for the original method. If so,
+             * any {@link StateSplit} node created in the (recursive) inlining scope will be given a
+             * frame state that restarts the interpreter just before the intrinsified invocation.
+             */
+            public final boolean adoptBeforeCallFrameState;
+
+            public InlineInfo(ResolvedJavaMethod methodToInline, boolean adoptBeforeCallFrameState) {
+                this.methodToInline = methodToInline;
+                this.adoptBeforeCallFrameState = adoptBeforeCallFrameState;
+            }
+        }
+
+        /**
+         * Determines whether a call to a given method is to be inlined.
+         *
+         * @param method the target method of an invoke
+         * @param args the arguments to the invoke
+         * @param returnType the return type derived from {@code method}'s signature
+         */
+        default InlineInfo getInlineInfo(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args, JavaType returnType) {
+            return null;
+        }
+
+        /**
+         * @param inlinedTargetMethod
+         */
+        default void postInline(ResolvedJavaMethod inlinedTargetMethod) {
+        }
+
+        /**
+         * Notifies this plugin of the {@link Invoke} node created for a method that was not inlined
+         * per {@link #getInlineInfo}.
+         *
+         * @param method the method that was not inlined
+         * @param invoke the invoke node created for the call to {@code method}
+         */
+        default void notifyOfNoninlinedInvoke(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod method, Invoke invoke) {
+        }
+    }
+
+    public interface LoopExplosionPlugin extends GraphBuilderPlugin {
+        boolean shouldExplodeLoops(ResolvedJavaMethod method);
+
+        boolean shouldMergeExplosions(ResolvedJavaMethod method);
+    }
+
+    public interface ParameterPlugin extends GraphBuilderPlugin {
+        FloatingNode interceptParameter(GraphBuilderContext b, int index, Stamp stamp);
+    }
+
+    /**
+     * Plugin for handling an invocation based on some property of the method being invoked such as
+     * any annotations it may have.
+     */
+    public interface GenericInvocationPlugin extends GraphBuilderPlugin {
+        /**
+         * Executes this plugin for an invocation of a given method with a given set of arguments.
+         *
+         * @return {@code true} if this plugin handled the invocation, {@code false} if not
+         */
+        boolean apply(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args);
+    }
+
+    /**
+     * Plugin for handling a specific method invocation.
+     */
+    public interface InvocationPlugin extends GraphBuilderPlugin {
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod) {
+            throw invalidHandler(b, targetMethod);
+        }
+
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg) {
+            throw invalidHandler(b, targetMethod, arg);
+        }
+
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2) {
+            throw invalidHandler(b, targetMethod, arg1, arg2);
+        }
+
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3) {
+            throw invalidHandler(b, targetMethod, arg1, arg2, arg3);
+        }
+
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4) {
+            throw invalidHandler(b, targetMethod, arg1, arg2, arg3, arg4);
+        }
+
+        /**
+         * @see #execute
+         */
+        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4, ValueNode arg5) {
+            throw invalidHandler(b, targetMethod, arg1, arg2, arg3, arg4, arg5);
+        }
+
+        default ResolvedJavaMethod getSubstitute() {
+            return null;
+        }
+
+        boolean ALLOW_INVOCATION_PLUGIN_TO_DO_INLINING = false;
+
+        /**
+         * Executes a given plugin against a set of invocation arguments by dispatching to the
+         * {@code apply(...)} method that matches the number of arguments.
+         *
+         * @param targetMethod the method for which plugin is being applied
+         * @return {@code true} if the plugin handled the invocation of {@code targetMethod}
+         *         {@code false} if the graph builder should process the invoke further (e.g., by
+         *         inlining it or creating an {@link Invoke} node). A plugin that does not handle an
+         *         invocation must not modify the graph being constructed.
+         */
+        static boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin plugin, ValueNode[] args) {
+// if (ALLOW_INVOCATION_PLUGIN_TO_DO_INLINING) {
+// ResolvedJavaMethod subst = plugin.getSubstitute();
+// if (subst != null) {
+// return ((BytecodeParser) b).inline(null, targetMethod, new InlineInfo(subst, false), args);
+// }
+// }
+            if (args.length == 0) {
+                return plugin.apply(b, targetMethod);
+            } else if (args.length == 1) {
+                return plugin.apply(b, targetMethod, args[0]);
+            } else if (args.length == 2) {
+                return plugin.apply(b, targetMethod, args[0], args[1]);
+            } else if (args.length == 3) {
+                return plugin.apply(b, targetMethod, args[0], args[1], args[2]);
+            } else if (args.length == 4) {
+                return plugin.apply(b, targetMethod, args[0], args[1], args[2], args[3]);
+            } else if (args.length == 5) {
+                return plugin.apply(b, targetMethod, args[0], args[1], args[2], args[3], args[4]);
+            } else {
+                throw plugin.invalidHandler(b, targetMethod, args);
+            }
+        }
+
+        default Error invalidHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode... args) {
+            return new GraalInternalError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length);
+        }
+
+        default StackTraceElement getApplySourceLocation(MetaAccessProvider metaAccess) {
+            Class<?> c = getClass();
+            for (Method m : c.getDeclaredMethods()) {
+                if (m.getName().equals("apply")) {
+                    return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
+                }
+            }
+            throw new GraalInternalError("could not find method named \"apply\" in " + c.getName());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Sun Mar 15 11:36:54 2015 +0100
@@ -0,0 +1,340 @@
+/*
+ * 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 static java.lang.String.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.stream.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.nodes.*;
+
+/**
+ * Manages a set of {@link InvocationPlugin}s.
+ */
+public class InvocationPlugins {
+
+    /**
+     * Sentinel class for use with
+     * {@link InvocationPlugins#register(InvocationPlugin, Class, String, Class...)} to denote the
+     * receiver argument for a non-static method.
+     */
+    public static final class Receiver {
+        private Receiver() {
+            throw GraalInternalError.shouldNotReachHere();
+        }
+    }
+
+    /**
+     * Utility for
+     * {@linkplain InvocationPlugins#register(InvocationPlugin, Class, String, Class...)
+     * registration} of invocation plugins.
+     */
+    public static class Registration {
+
+        private final InvocationPlugins plugins;
+        private final Class<?> declaringClass;
+
+        /**
+         * Creates an object for registering {@link InvocationPlugin}s for methods declared by a
+         * given class.
+         *
+         * @param plugins where to register the plugins
+         * @param declaringClass the class declaring the methods for which plugins will be
+         *            registered via this object
+         */
+        public Registration(InvocationPlugins plugins, Class<?> declaringClass) {
+            this.plugins = plugins;
+            this.declaringClass = declaringClass;
+        }
+
+        /**
+         * Registers a plugin for a method with no arguments.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register0(String name, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name);
+        }
+
+        /**
+         * Registers a plugin for a method with 1 argument.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register1(String name, Class<?> arg, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name, arg);
+        }
+
+        /**
+         * Registers a plugin for a method with 2 arguments.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register2(String name, Class<?> arg1, Class<?> arg2, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name, arg1, arg2);
+        }
+
+        /**
+         * Registers a plugin for a method with 3 arguments.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register3(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3);
+        }
+
+        /**
+         * Registers a plugin for a method with 4 arguments.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register4(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, Class<?> arg4, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3, arg4);
+        }
+
+        /**
+         * Registers a plugin for a method with 5 arguments.
+         *
+         * @param name the name of the method
+         * @param plugin the plugin to be registered
+         */
+        public void register5(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, Class<?> arg4, Class<?> arg5, InvocationPlugin plugin) {
+            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3, arg4, arg5);
+        }
+    }
+
+    public static final class MethodInfo {
+        public final boolean isStatic;
+        public final Class<?> declaringClass;
+        public final String name;
+        public final Class<?>[] argumentTypes;
+
+        public MethodInfo(Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+            this.isStatic = argumentTypes.length == 0 || argumentTypes[0] != Receiver.class;
+            this.declaringClass = declaringClass;
+            this.name = name;
+            this.argumentTypes = argumentTypes;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof MethodInfo) {
+                MethodInfo that = (MethodInfo) obj;
+                boolean res = this.declaringClass == that.declaringClass && this.name.equals(that.name) && 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();
+        }
+
+        public ResolvedJavaMethod resolve(MetaAccessProvider metaAccess) {
+            try {
+                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
+                ResolvedJavaMethod resolved;
+                if (name.equals("<init>")) {
+                    resolved = metaAccess.lookupJavaMethod(declaringClass.getDeclaredConstructor(parameterTypes));
+                } else {
+                    resolved = metaAccess.lookupJavaMethod(declaringClass.getDeclaredMethod(name, parameterTypes));
+                }
+                assert resolved.isStatic() == isStatic;
+                return resolved;
+            } 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 Map<MethodInfo, InvocationPlugin> registrations;
+
+    private final Thread registrationThread;
+
+    /**
+     * Null while registration is open, non-null when registration is closed.
+     */
+    private volatile Map<ResolvedJavaMethod, InvocationPlugin> plugins;
+
+    /**
+     * The invocation plugins deferred to if a plugin is not found in this object.
+     */
+    private InvocationPlugins defaults;
+
+    /**
+     * Creates a set of invocation plugins with a given non-null set of plugins as the
+     * {@linkplain #getDefaults defaults}.
+     */
+    public InvocationPlugins(InvocationPlugins defaults) {
+        this.registrationThread = Thread.currentThread();
+        this.metaAccess = defaults.getMetaAccess();
+        this.registrations = new HashMap<>();
+        InvocationPlugins defs = defaults;
+        // Only adopt non-empty defaults
+        while (defs != null && defs.size() == 0) {
+            defs = defs.defaults;
+        }
+        this.defaults = defs;
+    }
+
+    public InvocationPlugins(MetaAccessProvider metaAccess) {
+        this(metaAccess, 16);
+    }
+
+    public InvocationPlugins(MetaAccessProvider metaAccess, int estimatePluginCount) {
+        this.metaAccess = metaAccess;
+        this.registrations = new HashMap<>(estimatePluginCount);
+        this.registrationThread = Thread.currentThread();
+    }
+
+    /**
+     * Registers an invocation plugin for a given method. There must be no plugin currently
+     * registered for {@code method}.
+     */
+    public void register(InvocationPlugin plugin, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+        assert Thread.currentThread() == registrationThread : "invocation plugin registration must be single threaded";
+        MethodInfo method = new MethodInfo(declaringClass, name, argumentTypes);
+        assert Checker.check(method, plugin);
+        assert plugins == null : "invocation plugin registration is closed";
+        GraphBuilderPlugin oldValue = registrations.put(method, plugin);
+        assert oldValue == null : "a plugin is already registered for " + method;
+    }
+
+    /**
+     * Gets the plugin for a given method.
+     *
+     * @param method the method to lookup
+     * @return the plugin associated with {@code method} or {@code null} if none exists
+     */
+    public InvocationPlugin lookupInvocation(ResolvedJavaMethod method) {
+        InvocationPlugin res = null;
+        if (plugins == null) {
+            synchronized (this) {
+                if (plugins == null) {
+                    if (registrations.isEmpty()) {
+                        plugins = Collections.emptyMap();
+                    } else {
+                        // System.out.println("resolving " + registrations.size() + " plugins");
+                        plugins = new HashMap<>(registrations.size());
+                        for (Map.Entry<MethodInfo, InvocationPlugin> e : registrations.entrySet()) {
+                            plugins.put(e.getKey().resolve(metaAccess), e.getValue());
+                        }
+                    }
+                }
+            }
+        }
+        res = plugins.get(method);
+        if (res == null && defaults != null) {
+            return defaults.lookupInvocation(method);
+        }
+        return res;
+    }
+
+    /**
+     * Gets the invocation plugins {@linkplain #lookupInvocation(ResolvedJavaMethod) searched} if a
+     * plugin is not found in this object.
+     */
+    public InvocationPlugins getDefaults() {
+        return defaults;
+    }
+
+    @Override
+    public String toString() {
+        return registrations.keySet().stream().map(MethodInfo::toString).collect(Collectors.joining(", ")) + " / defaults: " + this.defaults;
+    }
+
+    private static class Checker {
+        private static final int MAX_ARITY = 5;
+        /**
+         * The set of all {@link InvocationPlugin#apply} method signatures.
+         */
+        static final Class<?>[][] SIGS;
+        static {
+            ArrayList<Class<?>[]> sigs = new ArrayList<>(MAX_ARITY);
+            for (Method method : InvocationPlugin.class.getDeclaredMethods()) {
+                if (!Modifier.isStatic(method.getModifiers()) && method.getName().equals("apply")) {
+                    Class<?>[] sig = method.getParameterTypes();
+                    assert sig[0] == GraphBuilderContext.class;
+                    assert sig[1] == ResolvedJavaMethod.class;
+                    assert Arrays.asList(Arrays.copyOfRange(sig, 2, sig.length)).stream().allMatch(c -> c == ValueNode.class);
+                    while (sigs.size() < sig.length - 1) {
+                        sigs.add(null);
+                    }
+                    sigs.set(sig.length - 2, sig);
+                }
+            }
+            assert sigs.indexOf(null) == -1 : format("need to add an apply() method to %s that takes %d %s arguments ", InvocationPlugin.class.getName(), sigs.indexOf(null),
+                            ValueNode.class.getSimpleName());
+            SIGS = sigs.toArray(new Class<?>[sigs.size()][]);
+        }
+
+        public static boolean check(MethodInfo method, InvocationPlugin plugin) {
+            int arguments = method.argumentTypes.length;
+            assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method);
+            for (Method m : plugin.getClass().getDeclaredMethods()) {
+                if (m.getName().equals("apply")) {
+                    Class<?>[] parameterTypes = m.getParameterTypes();
+                    if (Arrays.equals(SIGS[arguments], parameterTypes)) {
+                        return true;
+                    }
+                }
+            }
+            throw new AssertionError(format("graph builder plugin for %s not found", method));
+        }
+    }
+
+    public MetaAccessProvider getMetaAccess() {
+        return metaAccess;
+    }
+
+    public int size() {
+        return registrations.size();
+    }
+}
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Sun Mar 15 11:36:54 2015 +0100
@@ -31,10 +31,10 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.phases.util.*;
 
 @ServiceProvider(HotSpotBackendFactory.class)
@@ -260,15 +260,15 @@
         } else {
             /*
              * System V Application Binary Interface, AMD64 Architecture Processor Supplement
-             *
+             * 
              * Draft Version 0.96
-             *
+             * 
              * http://www.uclibc.org/docs/psABI-x86_64.pdf
-             *
+             * 
              * 3.2.1
-             *
+             * 
              * ...
-             *
+             * 
              * This subsection discusses usage of each register. Registers %rbp, %rbx and %r12
              * through %r15 "belong" to the calling function and the called function is required to
              * preserve their values. In other words, a called function must preserve these
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Sun Mar 15 11:36:54 2015 +0100
@@ -27,10 +27,10 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.sparc.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Sun Mar 15 11:36:54 2015 +0100
@@ -22,22 +22,21 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import static com.oracle.graal.graphbuilderconf.GraphBuilderContext.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
-import static com.oracle.graal.java.GraphBuilderContext.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.graphbuilderconf.InvocationPlugins.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.java.InvocationPlugins.Registration;
-import com.oracle.graal.java.InvocationPlugins.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInlineInvokePlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInlineInvokePlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -28,10 +28,10 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderContext.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderContext.Replacement;
-import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Sun Mar 15 11:36:54 2015 +0100
@@ -23,9 +23,9 @@
 package com.oracle.graal.hotspot.meta;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.java.*;
 import com.oracle.graal.replacements.StandardGraphBuilderPlugins.BoxPlugin;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadFieldPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadFieldPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -27,8 +27,8 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.nodes.*;
 
 public final class HotSpotLoadFieldPlugin implements LoadFieldPlugin {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadIndexedPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadIndexedPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -24,11 +24,11 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadIndexedPlugin;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.type.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.type.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java	Sun Mar 15 11:36:54 2015 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.hotspot.word.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Sun Mar 15 11:36:54 2015 +0100
@@ -24,12 +24,12 @@
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.DebugInfoMode;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.options.DerivedOptionValue.OptionSupplier;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -30,10 +30,10 @@
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode;
-import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.calc.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java	Sun Mar 15 11:36:54 2015 +0100
@@ -28,10 +28,11 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java	Sun Mar 15 11:36:54 2015 +0100
@@ -37,11 +37,11 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderContext.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.java.BciBlockMapping.BciBlock;
-import com.oracle.graal.java.GraphBuilderContext.Replacement;
 import com.oracle.graal.java.GraphBuilderPhase.Instance.BytecodeParser;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadIndexedPlugin;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/DefaultSuitesProvider.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/DefaultSuitesProvider.java	Sun Mar 15 11:36:54 2015 +0100
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.java;
 
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.options.DerivedOptionValue.OptionSupplier;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java	Sun Mar 15 10:52:22 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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.java;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.java.GraphBuilderPlugin.GenericInvocationPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadIndexedPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.LoopExplosionPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin;
-import com.oracle.graal.nodes.*;
-
-public class GraphBuilderConfiguration {
-
-    public static class Plugins {
-        private final InvocationPlugins invocationPlugins;
-        private LoadFieldPlugin loadFieldPlugin;
-        private LoadIndexedPlugin loadIndexedPlugin;
-        private ParameterPlugin parameterPlugin;
-        private InlineInvokePlugin inlineInvokePlugin;
-        private GenericInvocationPlugin genericInvocationPlugin;
-        private LoopExplosionPlugin loopExplosionPlugin;
-
-        /**
-         * Creates a copy of a given set of plugins. The {@link InvocationPlugins} in
-         * {@code copyFrom} become the {@linkplain InvocationPlugins#getDefaults() default}
-         * {@linkplain #getInvocationPlugins() invocation plugins} in this object.
-         */
-        public Plugins(Plugins copyFrom) {
-            this.invocationPlugins = new InvocationPlugins(copyFrom.invocationPlugins);
-            this.parameterPlugin = copyFrom.parameterPlugin;
-            this.loadFieldPlugin = copyFrom.loadFieldPlugin;
-            this.loadIndexedPlugin = copyFrom.loadIndexedPlugin;
-            this.inlineInvokePlugin = copyFrom.inlineInvokePlugin;
-            this.loopExplosionPlugin = copyFrom.loopExplosionPlugin;
-            this.genericInvocationPlugin = copyFrom.genericInvocationPlugin;
-        }
-
-        /**
-         * Creates a new set of plugins.
-         *
-         * @param invocationPlugins the {@linkplain #getInvocationPlugins() invocation plugins} in
-         *            this object
-         */
-        public Plugins(InvocationPlugins invocationPlugins) {
-            this.invocationPlugins = invocationPlugins;
-        }
-
-        public InvocationPlugins getInvocationPlugins() {
-            return invocationPlugins;
-        }
-
-        public GenericInvocationPlugin getGenericInvocationPlugin() {
-            return genericInvocationPlugin;
-        }
-
-        public void setGenericInvocationPlugin(GenericInvocationPlugin plugin) {
-            this.genericInvocationPlugin = plugin;
-        }
-
-        public LoadFieldPlugin getLoadFieldPlugin() {
-            return loadFieldPlugin;
-        }
-
-        public void setLoadFieldPlugin(LoadFieldPlugin plugin) {
-            this.loadFieldPlugin = plugin;
-        }
-
-        public LoadIndexedPlugin getLoadIndexedPlugin() {
-            return loadIndexedPlugin;
-        }
-
-        public void setLoadIndexedPlugin(LoadIndexedPlugin plugin) {
-            this.loadIndexedPlugin = plugin;
-        }
-
-        public ParameterPlugin getParameterPlugin() {
-            return parameterPlugin;
-        }
-
-        public void setParameterPlugin(ParameterPlugin plugin) {
-            this.parameterPlugin = plugin;
-        }
-
-        public InlineInvokePlugin getInlineInvokePlugin() {
-            return inlineInvokePlugin;
-        }
-
-        public void setInlineInvokePlugin(InlineInvokePlugin plugin) {
-            this.inlineInvokePlugin = plugin;
-        }
-
-        public LoopExplosionPlugin getLoopExplosionPlugin() {
-            return loopExplosionPlugin;
-        }
-
-        public void setLoopExplosionPlugin(LoopExplosionPlugin plugin) {
-            this.loopExplosionPlugin = plugin;
-        }
-    }
-
-    private static final ResolvedJavaType[] EMPTY = new ResolvedJavaType[]{};
-
-    private final boolean eagerResolving;
-    private final boolean omitAllExceptionEdges;
-    private final ResolvedJavaType[] skippedExceptionTypes;
-    private final DebugInfoMode debugInfoMode;
-    private final boolean doLivenessAnalysis;
-    private boolean useProfiling;
-    private final Plugins plugins;
-
-    public static enum DebugInfoMode {
-        SafePointsOnly,
-        /**
-         * This mode inserts {@link SimpleInfopointNode}s in places where no safepoints would be
-         * inserted: inlining boundaries, and line number switches.
-         * <p>
-         * In this mode the infopoint only have a location (method and bytecode index) and no
-         * values.
-         * <p>
-         * This is useful to have better program counter to bci mapping and has no influence on the
-         * generated code. However it can increase the amount of metadata and does not allow access
-         * to accessing values at runtime.
-         */
-        Simple,
-        /**
-         * In this mode, {@link FullInfopointNode}s are generated in the same locations as in
-         * {@link #Simple} mode but the infopoints have access to the runtime values.
-         * <p>
-         * This is relevant when code is to be generated for native, machine-code level debugging
-         * but can have a limit the amount of optimization applied to the code.
-         */
-        Full,
-    }
-
-    protected GraphBuilderConfiguration(boolean eagerResolving, boolean omitAllExceptionEdges, DebugInfoMode debugInfoMode, ResolvedJavaType[] skippedExceptionTypes, boolean doLivenessAnalysis,
-                    Plugins plugins) {
-        this.eagerResolving = eagerResolving;
-        this.omitAllExceptionEdges = omitAllExceptionEdges;
-        this.debugInfoMode = debugInfoMode;
-        this.skippedExceptionTypes = skippedExceptionTypes;
-        this.doLivenessAnalysis = doLivenessAnalysis;
-        this.useProfiling = true;
-        this.plugins = plugins;
-    }
-
-    /**
-     * Creates a copy of this configuration with all its plugins. The {@link InvocationPlugins} in
-     * this configuration become the {@linkplain InvocationPlugins#getDefaults defaults} of the
-     * {@link InvocationPlugins} in the copy.
-     */
-    public GraphBuilderConfiguration copy() {
-        Plugins newPlugins = new Plugins(new InvocationPlugins(plugins.getInvocationPlugins()));
-        GraphBuilderConfiguration result = new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, doLivenessAnalysis, newPlugins);
-        result.useProfiling = useProfiling;
-        return result;
-    }
-
-    public boolean getUseProfiling() {
-        return useProfiling;
-    }
-
-    public void setUseProfiling(boolean b) {
-        this.useProfiling = b;
-    }
-
-    public GraphBuilderConfiguration withSkippedExceptionTypes(ResolvedJavaType[] newSkippedExceptionTypes) {
-        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, newSkippedExceptionTypes, doLivenessAnalysis, plugins);
-    }
-
-    public GraphBuilderConfiguration withOmitAllExceptionEdges(boolean newOmitAllExceptionEdges) {
-        return new GraphBuilderConfiguration(eagerResolving, newOmitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, doLivenessAnalysis, plugins);
-    }
-
-    public GraphBuilderConfiguration withDebugInfoMode(DebugInfoMode newDebugInfoMode) {
-        ResolvedJavaType[] newSkippedExceptionTypes = skippedExceptionTypes == EMPTY ? EMPTY : Arrays.copyOf(skippedExceptionTypes, skippedExceptionTypes.length);
-        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, newDebugInfoMode, newSkippedExceptionTypes, doLivenessAnalysis, plugins);
-    }
-
-    public GraphBuilderConfiguration withDoLivenessAnalysis(boolean newLivenessAnalysis) {
-        return new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, debugInfoMode, skippedExceptionTypes, newLivenessAnalysis, plugins);
-    }
-
-    public ResolvedJavaType[] getSkippedExceptionTypes() {
-        return skippedExceptionTypes;
-    }
-
-    public boolean eagerResolving() {
-        return eagerResolving;
-    }
-
-    public boolean omitAllExceptionEdges() {
-        return omitAllExceptionEdges;
-    }
-
-    public boolean insertNonSafepointDebugInfo() {
-        return debugInfoMode.ordinal() >= DebugInfoMode.Simple.ordinal();
-    }
-
-    public boolean insertFullDebugInfo() {
-        return debugInfoMode.ordinal() >= DebugInfoMode.Full.ordinal();
-    }
-
-    public boolean doLivenessAnalysis() {
-        return doLivenessAnalysis;
-    }
-
-    public static GraphBuilderConfiguration getDefault(Plugins plugins) {
-        return new GraphBuilderConfiguration(false, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
-    }
-
-    public static GraphBuilderConfiguration getEagerDefault(Plugins plugins) {
-        return new GraphBuilderConfiguration(true, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
-    }
-
-    public static GraphBuilderConfiguration getSnippetDefault(Plugins plugins) {
-        return new GraphBuilderConfiguration(true, true, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
-    }
-
-    public static GraphBuilderConfiguration getFullDebugDefault(Plugins plugins) {
-        return new GraphBuilderConfiguration(true, false, DebugInfoMode.Full, EMPTY, GraalOptions.OptLivenessAnalysis.getValue(), plugins);
-    }
-
-    /**
-     * Returns {@code true} if it is an error for a class/field/method resolution to fail. The
-     * default is the same result as returned by {@link #eagerResolving()}. However, it may be
-     * overridden to allow failure even when {@link #eagerResolving} is {@code true}.
-     */
-    public boolean unresolvedIsError() {
-        return eagerResolving;
-    }
-
-    public Plugins getPlugins() {
-        return plugins;
-    }
-}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java	Sun Mar 15 10:52:22 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * 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.java;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.spi.*;
-
-/**
- * Used by a {@link GraphBuilderPlugin} to interface with a graph builder object.
- */
-public interface GraphBuilderContext {
-
-    /**
-     * Information about a snippet or method substitution currently being processed by the graph
-     * builder.
-     */
-    public interface Replacement {
-
-        /**
-         * Gets the method being replaced.
-         */
-        ResolvedJavaMethod getOriginalMethod();
-
-        /**
-         * Gets the replacement method.
-         */
-        ResolvedJavaMethod getReplacementMethod();
-
-        /**
-         * Determines if this replacement is being inlined as a compiler intrinsic. A compiler
-         * intrinsic is atomic with respect to deoptimization. Deoptimization within a compiler
-         * intrinsic will restart the interpreter at the intrinsified call.
-         */
-        boolean isIntrinsic();
-    }
-
-    <T extends ControlSinkNode> T append(T fixed);
-
-    <T extends ControlSplitNode> T append(T fixed);
-
-    <T extends FixedWithNextNode> T append(T fixed);
-
-    <T extends FloatingNode> T append(T value);
-
-    <T extends ValueNode> T append(T value);
-
-    StampProvider getStampProvider();
-
-    MetaAccessProvider getMetaAccess();
-
-    Assumptions getAssumptions();
-
-    ConstantReflectionProvider getConstantReflection();
-
-    SnippetReflectionProvider getSnippetReflection();
-
-    void push(Kind kind, ValueNode value);
-
-    StructuredGraph getGraph();
-
-    /**
-     * Gets the parsing context for the method that inlines the method being parsed by this context.
-     */
-    GraphBuilderContext getParent();
-
-    /**
-     * Gets the root method for the graph building process.
-     */
-    ResolvedJavaMethod getRootMethod();
-
-    /**
-     * Gets the method currently being parsed.
-     */
-    ResolvedJavaMethod getMethod();
-
-    /**
-     * Gets the index of the bytecode instruction currently being parsed.
-     */
-    int bci();
-
-    /**
-     * Gets the inline depth of this context. 0 implies this is the context for the
-     * {@linkplain #getRootMethod() root method}.
-     */
-    int getDepth();
-
-    /**
-     * Determines if the current parsing context is a snippet or method substitution.
-     */
-    default boolean parsingReplacement() {
-        return getReplacement() == null;
-    }
-
-    /**
-     * Gets the replacement of the current parsing context or {@code null} if not
-     * {@link #parsingReplacement() parsing a replacement}.
-     */
-    Replacement getReplacement();
-
-    /**
-     * @see GuardingPiNode#nullCheckedValue(ValueNode)
-     */
-    static ValueNode nullCheckedValue(GraphBuilderContext builder, ValueNode value) {
-        ValueNode nonNullValue = GuardingPiNode.nullCheckedValue(value);
-        if (nonNullValue != value) {
-            builder.append((FixedWithNextNode) nonNullValue);
-        }
-        return nonNullValue;
-    }
-
-    boolean eagerResolving();
-
-    BailoutException bailout(String string);
-}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Sun Mar 15 11:36:54 2015 +0100
@@ -46,14 +46,12 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.graph.iterators.*;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.InlineInvokePlugin.*;
 import com.oracle.graal.java.AbstractBytecodeParser.ReplacementContext;
 import com.oracle.graal.java.BciBlockMapping.BciBlock;
 import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock;
-import com.oracle.graal.java.GraphBuilderPlugin.GenericInvocationPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin.InlineInfo;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.LoopExplosionPlugin;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-/*
- * 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.java;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.java.GraphBuilderPhase.Instance.BytecodeParser;
-import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin.InlineInfo;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
-
-/**
- * Marker interface for graph builder plugins.
- */
-public interface GraphBuilderPlugin {
-
-    public interface LoadFieldPlugin extends GraphBuilderPlugin {
-        @SuppressWarnings("unused")
-        default boolean apply(GraphBuilderContext b, ValueNode receiver, ResolvedJavaField field) {
-            return false;
-        }
-
-        @SuppressWarnings("unused")
-        default boolean apply(GraphBuilderContext graphBuilderContext, ResolvedJavaField staticField) {
-            return false;
-        }
-
-        default boolean tryConstantFold(GraphBuilderContext b, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ResolvedJavaField field, JavaConstant receiver) {
-            JavaConstant result = constantReflection.readConstantFieldValue(field, receiver);
-            if (result != null) {
-                ConstantNode constantNode = b.append(ConstantNode.forConstant(result, metaAccess));
-                b.push(constantNode.getKind().getStackKind(), constantNode);
-                return true;
-            }
-            return false;
-        }
-    }
-
-    public interface LoadIndexedPlugin extends GraphBuilderPlugin {
-        @SuppressWarnings("unused")
-        default boolean apply(GraphBuilderContext b, ValueNode array, ValueNode index, Kind elementKind) {
-            return false;
-        }
-    }
-
-    /**
-     * Plugin for specifying what is inlined during graph parsing or for post-processing non-inlined
-     * invocations that result in {@link Invoke} nodes.
-     */
-    public interface InlineInvokePlugin extends GraphBuilderPlugin {
-
-        public static class InlineInfo {
-
-            /**
-             * The method to be inlined. If this is not equal to the {@code method} argument passed
-             * to {@link InlineInvokePlugin#getClass()}, the graph builder context interprets it as
-             * a {@linkplain GraphBuilderContext.Replacement replacement}.
-             */
-            public final ResolvedJavaMethod methodToInline;
-
-            /**
-             * Specifies if {@link #methodToInline} is an intrinsic for the original method. If so,
-             * any {@link StateSplit} node created in the (recursive) inlining scope will be given a
-             * frame state that restarts the interpreter just before the intrinsified invocation.
-             */
-            public final boolean adoptBeforeCallFrameState;
-
-            public InlineInfo(ResolvedJavaMethod methodToInline, boolean adoptBeforeCallFrameState) {
-                this.methodToInline = methodToInline;
-                this.adoptBeforeCallFrameState = adoptBeforeCallFrameState;
-            }
-        }
-
-        /**
-         * Determines whether a call to a given method is to be inlined.
-         *
-         * @param method the target method of an invoke
-         * @param args the arguments to the invoke
-         * @param returnType the return type derived from {@code method}'s signature
-         */
-        default InlineInfo getInlineInfo(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args, JavaType returnType) {
-            return null;
-        }
-
-        /**
-         * @param inlinedTargetMethod
-         */
-        default void postInline(ResolvedJavaMethod inlinedTargetMethod) {
-        }
-
-        /**
-         * Notifies this plugin of the {@link Invoke} node created for a method that was not inlined
-         * per {@link #getInlineInfo}.
-         *
-         * @param method the method that was not inlined
-         * @param invoke the invoke node created for the call to {@code method}
-         */
-        default void notifyOfNoninlinedInvoke(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod method, Invoke invoke) {
-        }
-    }
-
-    public interface LoopExplosionPlugin extends GraphBuilderPlugin {
-        boolean shouldExplodeLoops(ResolvedJavaMethod method);
-
-        boolean shouldMergeExplosions(ResolvedJavaMethod method);
-    }
-
-    public interface ParameterPlugin extends GraphBuilderPlugin {
-        FloatingNode interceptParameter(GraphBuilderContext b, int index, Stamp stamp);
-    }
-
-    /**
-     * Plugin for handling an invocation based on some property of the method being invoked such as
-     * any annotations it may have.
-     */
-    public interface GenericInvocationPlugin extends GraphBuilderPlugin {
-        /**
-         * Executes this plugin for an invocation of a given method with a given set of arguments.
-         *
-         * @return {@code true} if this plugin handled the invocation, {@code false} if not
-         */
-        boolean apply(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args);
-    }
-
-    /**
-     * Plugin for handling a specific method invocation.
-     */
-    public interface InvocationPlugin extends GraphBuilderPlugin {
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod) {
-            throw invalidHandler(b, targetMethod);
-        }
-
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg) {
-            throw invalidHandler(b, targetMethod, arg);
-        }
-
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2) {
-            throw invalidHandler(b, targetMethod, arg1, arg2);
-        }
-
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3) {
-            throw invalidHandler(b, targetMethod, arg1, arg2, arg3);
-        }
-
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4) {
-            throw invalidHandler(b, targetMethod, arg1, arg2, arg3, arg4);
-        }
-
-        /**
-         * @see #execute
-         */
-        default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4, ValueNode arg5) {
-            throw invalidHandler(b, targetMethod, arg1, arg2, arg3, arg4, arg5);
-        }
-
-        default ResolvedJavaMethod getSubstitute() {
-            return null;
-        }
-
-        boolean ALLOW_INVOCATION_PLUGIN_TO_DO_INLINING = false;
-
-        /**
-         * Executes a given plugin against a set of invocation arguments by dispatching to the
-         * {@code apply(...)} method that matches the number of arguments.
-         *
-         * @param targetMethod the method for which plugin is being applied
-         * @return {@code true} if the plugin handled the invocation of {@code targetMethod}
-         *         {@code false} if the graph builder should process the invoke further (e.g., by
-         *         inlining it or creating an {@link Invoke} node). A plugin that does not handle an
-         *         invocation must not modify the graph being constructed.
-         */
-        static boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin plugin, ValueNode[] args) {
-            if (ALLOW_INVOCATION_PLUGIN_TO_DO_INLINING) {
-                ResolvedJavaMethod subst = plugin.getSubstitute();
-                if (subst != null) {
-                    return ((BytecodeParser) b).inline(null, targetMethod, new InlineInfo(subst, false), args);
-                }
-            }
-            if (args.length == 0) {
-                return plugin.apply(b, targetMethod);
-            } else if (args.length == 1) {
-                return plugin.apply(b, targetMethod, args[0]);
-            } else if (args.length == 2) {
-                return plugin.apply(b, targetMethod, args[0], args[1]);
-            } else if (args.length == 3) {
-                return plugin.apply(b, targetMethod, args[0], args[1], args[2]);
-            } else if (args.length == 4) {
-                return plugin.apply(b, targetMethod, args[0], args[1], args[2], args[3]);
-            } else if (args.length == 5) {
-                return plugin.apply(b, targetMethod, args[0], args[1], args[2], args[3], args[4]);
-            } else {
-                throw plugin.invalidHandler(b, targetMethod, args);
-            }
-        }
-
-        default Error invalidHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode... args) {
-            return new GraalInternalError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length);
-        }
-
-        default StackTraceElement getApplySourceLocation(MetaAccessProvider metaAccess) {
-            Class<?> c = getClass();
-            for (Method m : c.getDeclaredMethods()) {
-                if (m.getName().equals("apply")) {
-                    return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
-                }
-            }
-            throw new GraalInternalError("could not find method named \"apply\" in " + c.getName());
-        }
-    }
-}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java	Sun Mar 15 11:36:54 2015 +0100
@@ -31,10 +31,10 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.java.AbstractBytecodeParser.IntrinsicContext;
 import com.oracle.graal.java.BciBlockMapping.BciBlock;
 import com.oracle.graal.java.GraphBuilderPhase.Instance.BytecodeParser;
-import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java	Sun Mar 15 10:52:22 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-/*
- * 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.java;
-
-import static java.lang.String.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.stream.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.nodes.*;
-
-/**
- * Manages a set of {@link InvocationPlugin}s.
- */
-public class InvocationPlugins {
-
-    /**
-     * Sentinel class for use with
-     * {@link InvocationPlugins#register(InvocationPlugin, Class, String, Class...)} to denote the
-     * receiver argument for a non-static method.
-     */
-    public static final class Receiver {
-        private Receiver() {
-            throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
-    /**
-     * Utility for
-     * {@linkplain InvocationPlugins#register(InvocationPlugin, Class, String, Class...)
-     * registration} of invocation plugins.
-     */
-    public static class Registration {
-
-        private final InvocationPlugins plugins;
-        private final Class<?> declaringClass;
-
-        /**
-         * Creates an object for registering {@link InvocationPlugin}s for methods declared by a
-         * given class.
-         *
-         * @param plugins where to register the plugins
-         * @param declaringClass the class declaring the methods for which plugins will be
-         *            registered via this object
-         */
-        public Registration(InvocationPlugins plugins, Class<?> declaringClass) {
-            this.plugins = plugins;
-            this.declaringClass = declaringClass;
-        }
-
-        /**
-         * Registers a plugin for a method with no arguments.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register0(String name, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name);
-        }
-
-        /**
-         * Registers a plugin for a method with 1 argument.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register1(String name, Class<?> arg, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name, arg);
-        }
-
-        /**
-         * Registers a plugin for a method with 2 arguments.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register2(String name, Class<?> arg1, Class<?> arg2, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name, arg1, arg2);
-        }
-
-        /**
-         * Registers a plugin for a method with 3 arguments.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register3(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3);
-        }
-
-        /**
-         * Registers a plugin for a method with 4 arguments.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register4(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, Class<?> arg4, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3, arg4);
-        }
-
-        /**
-         * Registers a plugin for a method with 5 arguments.
-         *
-         * @param name the name of the method
-         * @param plugin the plugin to be registered
-         */
-        public void register5(String name, Class<?> arg1, Class<?> arg2, Class<?> arg3, Class<?> arg4, Class<?> arg5, InvocationPlugin plugin) {
-            plugins.register(plugin, declaringClass, name, arg1, arg2, arg3, arg4, arg5);
-        }
-    }
-
-    public static final class MethodInfo {
-        public final boolean isStatic;
-        public final Class<?> declaringClass;
-        public final String name;
-        public final Class<?>[] argumentTypes;
-
-        public MethodInfo(Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-            this.isStatic = argumentTypes.length == 0 || argumentTypes[0] != Receiver.class;
-            this.declaringClass = declaringClass;
-            this.name = name;
-            this.argumentTypes = argumentTypes;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof MethodInfo) {
-                MethodInfo that = (MethodInfo) obj;
-                boolean res = this.declaringClass == that.declaringClass && this.name.equals(that.name) && 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();
-        }
-
-        public ResolvedJavaMethod resolve(MetaAccessProvider metaAccess) {
-            try {
-                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
-                ResolvedJavaMethod resolved;
-                if (name.equals("<init>")) {
-                    resolved = metaAccess.lookupJavaMethod(declaringClass.getDeclaredConstructor(parameterTypes));
-                } else {
-                    resolved = metaAccess.lookupJavaMethod(declaringClass.getDeclaredMethod(name, parameterTypes));
-                }
-                assert resolved.isStatic() == isStatic;
-                return resolved;
-            } 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 Map<MethodInfo, InvocationPlugin> registrations;
-
-    private final Thread registrationThread;
-
-    /**
-     * Null while registration is open, non-null when registration is closed.
-     */
-    private volatile Map<ResolvedJavaMethod, InvocationPlugin> plugins;
-
-    /**
-     * The invocation plugins deferred to if a plugin is not found in this object.
-     */
-    private InvocationPlugins defaults;
-
-    /**
-     * Creates a set of invocation plugins with a given non-null set of plugins as the
-     * {@linkplain #getDefaults defaults}.
-     */
-    public InvocationPlugins(InvocationPlugins defaults) {
-        this.registrationThread = Thread.currentThread();
-        this.metaAccess = defaults.getMetaAccess();
-        this.registrations = new HashMap<>();
-        InvocationPlugins defs = defaults;
-        // Only adopt non-empty defaults
-        while (defs != null && defs.size() == 0) {
-            defs = defs.defaults;
-        }
-        this.defaults = defs;
-    }
-
-    public InvocationPlugins(MetaAccessProvider metaAccess) {
-        this(metaAccess, 16);
-    }
-
-    public InvocationPlugins(MetaAccessProvider metaAccess, int estimatePluginCount) {
-        this.metaAccess = metaAccess;
-        this.registrations = new HashMap<>(estimatePluginCount);
-        this.registrationThread = Thread.currentThread();
-    }
-
-    /**
-     * Registers an invocation plugin for a given method. There must be no plugin currently
-     * registered for {@code method}.
-     */
-    public void register(InvocationPlugin plugin, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-        assert Thread.currentThread() == registrationThread : "invocation plugin registration must be single threaded";
-        MethodInfo method = new MethodInfo(declaringClass, name, argumentTypes);
-        assert Checker.check(method, plugin);
-        assert plugins == null : "invocation plugin registration is closed";
-        GraphBuilderPlugin oldValue = registrations.put(method, plugin);
-        assert oldValue == null : "a plugin is already registered for " + method;
-    }
-
-    /**
-     * Gets the plugin for a given method.
-     *
-     * @param method the method to lookup
-     * @return the plugin associated with {@code method} or {@code null} if none exists
-     */
-    public InvocationPlugin lookupInvocation(ResolvedJavaMethod method) {
-        InvocationPlugin res = null;
-        if (plugins == null) {
-            synchronized (this) {
-                if (plugins == null) {
-                    if (registrations.isEmpty()) {
-                        plugins = Collections.emptyMap();
-                    } else {
-                        // System.out.println("resolving " + registrations.size() + " plugins");
-                        plugins = new HashMap<>(registrations.size());
-                        for (Map.Entry<MethodInfo, InvocationPlugin> e : registrations.entrySet()) {
-                            plugins.put(e.getKey().resolve(metaAccess), e.getValue());
-                        }
-                    }
-                }
-            }
-        }
-        res = plugins.get(method);
-        if (res == null && defaults != null) {
-            return defaults.lookupInvocation(method);
-        }
-        return res;
-    }
-
-    /**
-     * Gets the invocation plugins {@linkplain #lookupInvocation(ResolvedJavaMethod) searched} if a
-     * plugin is not found in this object.
-     */
-    public InvocationPlugins getDefaults() {
-        return defaults;
-    }
-
-    @Override
-    public String toString() {
-        return registrations.keySet().stream().map(MethodInfo::toString).collect(Collectors.joining(", ")) + " / defaults: " + this.defaults;
-    }
-
-    private static class Checker {
-        private static final int MAX_ARITY = 5;
-        /**
-         * The set of all {@link InvocationPlugin#apply} method signatures.
-         */
-        static final Class<?>[][] SIGS;
-        static {
-            ArrayList<Class<?>[]> sigs = new ArrayList<>(MAX_ARITY);
-            for (Method method : InvocationPlugin.class.getDeclaredMethods()) {
-                if (!Modifier.isStatic(method.getModifiers()) && method.getName().equals("apply")) {
-                    Class<?>[] sig = method.getParameterTypes();
-                    assert sig[0] == GraphBuilderContext.class;
-                    assert sig[1] == ResolvedJavaMethod.class;
-                    assert Arrays.asList(Arrays.copyOfRange(sig, 2, sig.length)).stream().allMatch(c -> c == ValueNode.class);
-                    while (sigs.size() < sig.length - 1) {
-                        sigs.add(null);
-                    }
-                    sigs.set(sig.length - 2, sig);
-                }
-            }
-            assert sigs.indexOf(null) == -1 : format("need to add an apply() method to %s that takes %d %s arguments ", InvocationPlugin.class.getName(), sigs.indexOf(null),
-                            ValueNode.class.getSimpleName());
-            SIGS = sigs.toArray(new Class<?>[sigs.size()][]);
-        }
-
-        public static boolean check(MethodInfo method, InvocationPlugin plugin) {
-            int arguments = method.argumentTypes.length;
-            assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method);
-            for (Method m : plugin.getClass().getDeclaredMethods()) {
-                if (m.getName().equals("apply")) {
-                    Class<?>[] parameterTypes = m.getParameterTypes();
-                    if (Arrays.equals(SIGS[arguments], parameterTypes)) {
-                        return true;
-                    }
-                }
-            }
-            throw new AssertionError(format("graph builder plugin for %s not found", method));
-        }
-    }
-
-    public MetaAccessProvider getMetaAccess() {
-        return metaAccess;
-    }
-
-    public int size() {
-        return registrations.size();
-    }
-}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ConstantBindingParameterPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ConstantBindingParameterPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -25,8 +25,8 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.GenericInvocationPlugin;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Sun Mar 15 11:36:54 2015 +0100
@@ -42,9 +42,10 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.Graph.Mark;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.java.GraphBuilderPhase.Instance;
 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	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java	Sun Mar 15 11:36:54 2015 +0100
@@ -23,7 +23,7 @@
 package com.oracle.graal.replacements;
 
 import static com.oracle.graal.api.code.MemoryBarriers.*;
-import static com.oracle.graal.java.GraphBuilderContext.*;
+import static com.oracle.graal.graphbuilderconf.GraphBuilderContext.*;
 import static com.oracle.graal.replacements.nodes.MathIntrinsicNode.Operation.*;
 import sun.misc.*;
 
@@ -32,10 +32,9 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.java.InvocationPlugins.Receiver;
-import com.oracle.graal.java.InvocationPlugins.Registration;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.graphbuilderconf.InvocationPlugins.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.debug.*;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Sun Mar 15 11:36:54 2015 +0100
@@ -32,8 +32,8 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.GenericInvocationPlugin;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.calc.*;
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ExactMathTest.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ExactMathTest.java	Sun Mar 15 11:36:54 2015 +0100
@@ -25,7 +25,7 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.java.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.truffle.substitutions.*;
 import com.oracle.truffle.api.*;
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Sun Mar 15 11:36:54 2015 +0100
@@ -36,12 +36,12 @@
 import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.graph.Graph.Mark;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin;
-import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin;
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
@@ -63,7 +63,6 @@
 import com.oracle.graal.truffle.nodes.frame.*;
 import com.oracle.graal.truffle.nodes.frame.NewFrameNode.VirtualOnlyInstanceNode;
 import com.oracle.graal.truffle.phases.*;
-import com.oracle.graal.truffle.substitutions.*;
 import com.oracle.graal.virtual.phases.ea.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Sun Mar 15 11:36:54 2015 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node;
 import com.oracle.graal.graph.spi.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Sun Mar 15 11:36:54 2015 +0100
@@ -36,8 +36,9 @@
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Sun Mar 15 10:52:22 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Sun Mar 15 11:36:54 2015 +0100
@@ -31,10 +31,9 @@
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin;
-import com.oracle.graal.java.InvocationPlugins.Registration;
-import com.oracle.graal.java.InvocationPlugins.Receiver;
+import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderPlugin.*;
+import com.oracle.graal.graphbuilderconf.InvocationPlugins.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
--- a/mx/suite.py	Sun Mar 15 10:52:22 2015 +0100
+++ b/mx/suite.py	Sun Mar 15 11:36:54 2015 +0100
@@ -803,6 +803,7 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
         "com.oracle.graal.phases",
+        "com.oracle.graal.graphbuilderconf"
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "annotationProcessors" : ["com.oracle.graal.service.processor"],
@@ -810,6 +811,17 @@
       "workingSets" : "Graal,Java",
     },
 
+    "com.oracle.graal.graphbuilderconf" : {
+      "subDir" : "graal",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "com.oracle.graal.nodes",
+      ],
+      "checkstyle" : "com.oracle.graal.graph",
+      "javaCompliance" : "1.8",
+      "workingSets" : "Graal,Java",
+    },
+
     "com.oracle.graal.compiler.common" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],