changeset 20051:b7477f2df553

removed MacroSubstitution and its related machinery
author Doug Simon <doug.simon@oracle.com>
date Fri, 27 Mar 2015 16:04:23 +0100
parents a1d73b4fd139
children eea134855f85 d7c48ee7ed4b
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/MacroSubstitution.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/Inlineable.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableMacroNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolderDummy.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.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/TruffleReplacements.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/ReplaceIntrinsicsPhase.java
diffstat 15 files changed, 30 insertions(+), 344 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java	Fri Mar 27 16:04:23 2015 +0100
@@ -88,7 +88,6 @@
                 }
                 if (BootstrapReplacements.getValue()) {
                     for (ResolvedJavaMethod method : replacements.getAllReplacements()) {
-                        replacements.getMacroSubstitution(method);
                         replacements.getMethodSubstitution(method);
                     }
                 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/MacroSubstitution.java	Fri Mar 27 15:37:42 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 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.nodes.spi;
-
-import java.lang.annotation.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.nodes.*;
-
-/**
- * Denotes a macro substitute method. This replaces a method invocation with an instance of the
- * {@link #macro() specified} node class.
- * <p>
- * A macro substitution can be combined with a {@link MethodSubstitution method substitution}. In
- * this case, if the macro is not removed during canonicalization, it is lowered via the method
- * substitution.
- * <p>
- * If a macro is not combined with a method substitution, it is lowered to an invocation of the
- * original method.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface MacroSubstitution {
-
-    /**
-     * Gets the name of the substituted method.
-     * <p>
-     * If the default value is specified for this element, then the name of the substituted method
-     * is same as the substitute method.
-     */
-    String value() default "";
-
-    /**
-     * Determines if the substituted method is static.
-     */
-    boolean isStatic() default true;
-
-    /**
-     * Gets the {@linkplain Signature#toMethodDescriptor signature} of the substituted method.
-     * <p>
-     * If the default value is specified for this element, then the signature of the substituted
-     * method is the same as the substitute method.
-     */
-    String signature() default "";
-
-    /**
-     * Determines if the substitution is for a method that may not be part of the runtime. For
-     * example, a method introduced in a later JDK version. Substitutions for such methods are
-     * omitted if the original method cannot be found.
-     */
-    boolean optional() default false;
-
-    /**
-     * The node class with which the method invocation should be replaced. It needs to be a subclass
-     * of {@link FixedWithNextNode}, and it is expected to provide a public constructor that takes
-     * an {@link InvokeNode} as a parameter.
-     */
-    Class<? extends FixedWithNextNode> macro();
-
-    /**
-     * Determines if this method should be substituted in all cases, even if inlining thinks it is
-     * not important.
-     *
-     * Note that this is still depending on whether inlining sees the correct call target, so it's
-     * only a hard guarantee for static and special invocations.
-     */
-    boolean forced() default false;
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Fri Mar 27 16:04:23 2015 +0100
@@ -47,7 +47,7 @@
      *
      * @param recursiveEntry if the snippet contains a call to this method, it's considered as
      *            recursive call and won't be processed for {@linkplain MethodSubstitution
-     *            substitutions} or {@linkplain MacroSubstitution macro nodes}.
+     *            substitutions}.
      * @param args arguments to the snippet if available, otherwise {@code null}
      * @return the snippet graph, if any, that is derived from {@code method}
      */
@@ -82,17 +82,8 @@
     ResolvedJavaMethod getMethodSubstitutionMethod(ResolvedJavaMethod method);
 
     /**
-     * Gets the node class with which a method invocation should be replaced.
-     *
-     * @param method target of an invocation
-     * @return the {@linkplain MacroSubstitution#macro() macro node class} associated with
-     *         {@code method} or null if there is no such association
-     */
-    Class<? extends FixedWithNextNode> getMacroSubstitution(ResolvedJavaMethod method);
-
-    /**
-     * Registers all the {@linkplain MethodSubstitution method} and {@linkplain MacroSubstitution
-     * macro} substitutions defined by a given class.
+     * Registers all the {@linkplain MethodSubstitution method} substitutions defined by a given
+     * class.
      *
      * @param original the original class for which substitutions are being registered. This must be
      *            the same type denoted by the {@link ClassSubstitution} annotation on
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Fri Mar 27 16:04:23 2015 +0100
@@ -574,17 +574,13 @@
     }
 
     public static boolean canIntrinsify(Replacements replacements, ResolvedJavaMethod target) {
-        return replacements.getMethodSubstitutionMethod(target) != null || getMacroNodeClass(replacements, target) != null;
+        return replacements.getMethodSubstitutionMethod(target) != null;
     }
 
     public static StructuredGraph getIntrinsicGraph(Replacements replacements, ResolvedJavaMethod target) {
         return replacements.getMethodSubstitution(target);
     }
 
-    public static Class<? extends FixedWithNextNode> getMacroNodeClass(Replacements replacements, ResolvedJavaMethod target) {
-        return replacements.getMacroSubstitution(target);
-    }
-
     public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws GraalInternalError {
         StructuredGraph graph = invoke.asNode().graph();
         if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java	Fri Mar 27 16:04:23 2015 +0100
@@ -52,17 +52,10 @@
 
     protected static Collection<Node> inline(Invoke invoke, ResolvedJavaMethod concrete, Inlineable inlineable, boolean receiverNullCheck) {
         List<Node> canonicalizeNodes = new ArrayList<>();
-        if (inlineable instanceof InlineableGraph) {
-            StructuredGraph calleeGraph = ((InlineableGraph) inlineable).getGraph();
-            Map<Node, Node> duplicateMap = InliningUtil.inline(invoke, calleeGraph, receiverNullCheck, canonicalizeNodes);
-            getInlinedParameterUsages(canonicalizeNodes, calleeGraph, duplicateMap);
-        } else {
-            assert inlineable instanceof InlineableMacroNode;
-
-            Class<? extends FixedWithNextNode> macroNodeClass = ((InlineableMacroNode) inlineable).getMacroNodeClass();
-            FixedWithNextNode macroNode = InliningUtil.inlineMacroNode(invoke, concrete, macroNodeClass);
-            canonicalizeNodes.add(macroNode);
-        }
+        assert inlineable instanceof InlineableGraph;
+        StructuredGraph calleeGraph = ((InlineableGraph) inlineable).getGraph();
+        Map<Node, Node> duplicateMap = InliningUtil.inline(invoke, calleeGraph, receiverNullCheck, canonicalizeNodes);
+        getInlinedParameterUsages(canonicalizeNodes, calleeGraph, duplicateMap);
 
         InliningUtil.InlinedBytecodes.add(concrete.getCodeSize());
         StructuredGraph graph = invoke.asNode().graph();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/Inlineable.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/Inlineable.java	Fri Mar 27 16:04:23 2015 +0100
@@ -22,24 +22,17 @@
  */
 package com.oracle.graal.phases.common.inlining.info.elem;
 
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
-import com.oracle.graal.nodes.FixedWithNextNode;
-import com.oracle.graal.nodes.Invoke;
-import com.oracle.graal.phases.common.CanonicalizerPhase;
-import com.oracle.graal.phases.common.inlining.InliningUtil;
-import com.oracle.graal.phases.tiers.HighTierContext;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.tiers.*;
 
 public interface Inlineable {
 
     static Inlineable getInlineableElement(final ResolvedJavaMethod method, Invoke invoke, HighTierContext context, CanonicalizerPhase canonicalizer) {
         assert method != null;
         assert invoke != null;
-        Class<? extends FixedWithNextNode> macroNodeClass = InliningUtil.getMacroNodeClass(context.getReplacements(), method);
-        if (macroNodeClass != null) {
-            return new InlineableMacroNode(macroNodeClass);
-        } else {
-            return new InlineableGraph(method, invoke, context, canonicalizer);
-        }
+        return new InlineableGraph(method, invoke, context, canonicalizer);
     }
 
     int getNodeCount();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableMacroNode.java	Fri Mar 27 15:37:42 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012, 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.phases.common.inlining.info.elem;
-
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.nodes.FixedWithNextNode;
-import com.oracle.graal.nodes.Invoke;
-
-import java.util.Collections;
-
-public class InlineableMacroNode implements Inlineable {
-
-    private final Class<? extends FixedWithNextNode> macroNodeClass;
-
-    public InlineableMacroNode(Class<? extends FixedWithNextNode> macroNodeClass) {
-        this.macroNodeClass = macroNodeClass;
-    }
-
-    @Override
-    public int getNodeCount() {
-        return 1;
-    }
-
-    @Override
-    public Iterable<Invoke> getInvokes() {
-        return Collections.emptyList();
-    }
-
-    public Class<? extends FixedWithNextNode> getMacroNodeClass() {
-        return macroNodeClass;
-    }
-
-    public double getProbability(Invoke invoke) {
-        throw GraalInternalError.shouldNotReachHere("No invokes in inlineable");
-    }
-}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolderDummy.java	Fri Mar 27 15:37:42 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2011, 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.phases.common.inlining.walker;
-
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
-import com.oracle.graal.nodes.StructuredGraph;
-
-import com.oracle.graal.phases.common.inlining.info.elem.InlineableMacroNode;
-
-/**
- * A {@link CallsiteHolder} that stands for an {@link InlineableMacroNode} in the stack realized by
- * {@link InliningData}.
- */
-public final class CallsiteHolderDummy extends CallsiteHolder {
-
-    public static final CallsiteHolderDummy DUMMY_CALLSITE_HOLDER = new CallsiteHolderDummy();
-
-    private CallsiteHolderDummy() {
-        // no instances other than the singleton
-    }
-
-    @Override
-    public ResolvedJavaMethod method() {
-        return null;
-    }
-
-    @Override
-    public boolean hasRemainingInvokes() {
-        return false;
-    }
-
-    @Override
-    public StructuredGraph graph() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "<macro-node>";
-    }
-}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java	Fri Mar 27 16:04:23 2015 +0100
@@ -23,7 +23,6 @@
 package com.oracle.graal.phases.common.inlining.walker;
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.phases.common.inlining.walker.CallsiteHolderDummy.*;
 
 import java.util.*;
 
@@ -560,7 +559,7 @@
         assert graphQueue.size() <= maxGraphs;
         for (int i = 0; i < info.numberOfMethods(); i++) {
             CallsiteHolder ch = methodInvocation.buildCallsiteHolderForElement(i);
-            assert (ch == DUMMY_CALLSITE_HOLDER) || !contains(ch.graph());
+            assert !contains(ch.graph());
             graphQueue.push(ch);
             assert graphQueue.size() <= maxGraphs;
         }
@@ -733,12 +732,8 @@
             }
             CallsiteHolder queuedTargetCH = iter.next();
             Inlineable targetIE = currentInvocation().callee().inlineableElementAt(i);
-            if (targetIE instanceof InlineableMacroNode) {
-                assert queuedTargetCH == DUMMY_CALLSITE_HOLDER;
-            } else {
-                InlineableGraph targetIG = (InlineableGraph) targetIE;
-                assert queuedTargetCH.method().equals(targetIG.getGraph().method());
-            }
+            InlineableGraph targetIG = (InlineableGraph) targetIE;
+            assert queuedTargetCH.method().equals(targetIG.getGraph().method());
         }
         return true;
     }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java	Fri Mar 27 16:04:23 2015 +0100
@@ -123,15 +123,11 @@
 
     public CallsiteHolder buildCallsiteHolderForElement(int index) {
         Inlineable elem = callee.inlineableElementAt(index);
-        if (elem instanceof InlineableGraph) {
-            InlineableGraph ig = (InlineableGraph) elem;
-            final double invokeProbability = probability * callee.probabilityAt(index);
-            final double invokeRelevance = relevance * callee.relevanceAt(index);
-            return new CallsiteHolderExplorable(ig.getGraph(), invokeProbability, invokeRelevance, freshlyInstantiatedArguments);
-        } else {
-            assert elem instanceof InlineableMacroNode;
-            return CallsiteHolderDummy.DUMMY_CALLSITE_HOLDER;
-        }
+        assert elem instanceof InlineableGraph;
+        InlineableGraph ig = (InlineableGraph) elem;
+        final double invokeProbability = probability * callee.probabilityAt(index);
+        final double invokeRelevance = relevance * callee.relevanceAt(index);
+        return new CallsiteHolderExplorable(ig.getGraph(), invokeProbability, invokeRelevance, freshlyInstantiatedArguments);
     }
 
     @Override
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Mar 27 16:04:23 2015 +0100
@@ -136,7 +136,6 @@
      */
     protected class ClassReplacements {
         public final Map<ResolvedJavaMethod, ResolvedJavaMethod> methodSubstitutions = CollectionsFactory.newMap();
-        public final Map<ResolvedJavaMethod, Class<? extends FixedWithNextNode>> macroSubstitutions = CollectionsFactory.newMap();
         public final Set<ResolvedJavaMethod> forcedSubstitutions = new HashSet<>();
 
         public ClassReplacements(Class<?>[] substitutionClasses, AtomicReference<ClassReplacements> ref) {
@@ -150,8 +149,7 @@
                         return;
                     }
                     MethodSubstitution methodSubstitution = substituteMethod.getAnnotation(MethodSubstitution.class);
-                    MacroSubstitution macroSubstitution = substituteMethod.getAnnotation(MacroSubstitution.class);
-                    if (methodSubstitution == null && macroSubstitution == null) {
+                    if (methodSubstitution == null) {
                         continue;
                     }
 
@@ -166,9 +164,6 @@
                             guard = defaultGuard;
                         }
 
-                        if (macroSubstitution != null && macroSubstitution.isStatic() != methodSubstitution.isStatic()) {
-                            throw new GraalInternalError("Macro and method substitution must agree on isStatic attribute: " + substituteMethod);
-                        }
                         if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
                             throw new GraalInternalError("Substitution method must not be abstract or native: " + substituteMethod);
                         }
@@ -186,21 +181,6 @@
                             }
                         }
                     }
-                    // We don't have per method guards for macro substitutions but at
-                    // least respect the defaultGuard if there is one.
-                    if (macroSubstitution != null && (defaultGuard == null || defaultGuard.execute())) {
-                        String originalName = originalName(substituteMethod, macroSubstitution.value());
-                        JavaSignature originalSignature = originalSignature(substituteMethod, macroSubstitution.signature(), macroSubstitution.isStatic());
-                        Executable[] originalMethods = originalMethods(classSubstitution, macroSubstitution.optional(), originalName, originalSignature);
-                        for (Executable originalMethod : originalMethods) {
-                            if (originalMethod != null) {
-                                ResolvedJavaMethod original = registerMacroSubstitution(this, originalMethod, macroSubstitution.macro());
-                                if (original != null && macroSubstitution.forced() && shouldIntrinsify(original)) {
-                                    forcedSubstitutions.add(original);
-                                }
-                            }
-                        }
-                    }
                 }
             }
         }
@@ -377,11 +357,6 @@
 
     }
 
-    public Class<? extends FixedWithNextNode> getMacroSubstitution(ResolvedJavaMethod method) {
-        ClassReplacements cr = getClassReplacements(method.getDeclaringClass().getName());
-        return cr == null ? null : cr.macroSubstitutions.get(method);
-    }
-
     private SubstitutionGuard getGuard(Class<? extends SubstitutionGuard> guardClass) {
         if (guardClass != SubstitutionGuard.class) {
             Constructor<?>[] constructors = guardClass.getConstructors();
@@ -465,20 +440,6 @@
     }
 
     /**
-     * Registers a macro substitution.
-     *
-     * @param originalMethod a method or constructor being substituted
-     * @param macro the substitute macro node class
-     * @return the original method
-     */
-    protected ResolvedJavaMethod registerMacroSubstitution(ClassReplacements cr, Executable originalMethod, Class<? extends FixedWithNextNode> macro) {
-        MetaAccessProvider metaAccess = providers.getMetaAccess();
-        ResolvedJavaMethod originalJavaMethod = metaAccess.lookupJavaMethod(originalMethod);
-        cr.macroSubstitutions.put(originalJavaMethod, macro);
-        return originalJavaMethod;
-    }
-
-    /**
      * Creates a preprocessed graph for a snippet or method substitution.
      *
      * @param method the snippet or method substitution for which a graph will be created
@@ -826,7 +787,6 @@
         for (String internalName : classReplacements.keySet()) {
             ClassReplacements cr = getClassReplacements(internalName);
             result.addAll(cr.methodSubstitutions.keySet());
-            result.addAll(cr.macroSubstitutions.keySet());
         }
         return result;
     }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Fri Mar 27 16:04:23 2015 +0100
@@ -209,7 +209,7 @@
                     return inlineInfo;
                 }
             }
-            if (replacements != null && (replacements.getMethodSubstitutionMethod(original) != null || replacements.getMacroSubstitution(original) != null)) {
+            if (replacements != null && replacements.getMethodSubstitutionMethod(original) != null) {
                 return null;
             }
             assert !builder.parsingReplacement();
@@ -340,14 +340,9 @@
         new ConvertDeoptimizeToGuardPhase().apply(graph, tierContext);
 
         for (MethodCallTargetNode methodCallTargetNode : graph.getNodes(MethodCallTargetNode.TYPE)) {
-            Class<? extends FixedWithNextNode> macroSubstitution = providers.getReplacements().getMacroSubstitution(methodCallTargetNode.targetMethod());
-            if (macroSubstitution != null) {
-                InliningUtil.inlineMacroNode(methodCallTargetNode.invoke(), methodCallTargetNode.targetMethod(), macroSubstitution);
-            } else {
-                StructuredGraph inlineGraph = providers.getReplacements().getMethodSubstitution(methodCallTargetNode.targetMethod());
-                if (inlineGraph != null) {
-                    InliningUtil.inline(methodCallTargetNode.invoke(), inlineGraph, true, null);
-                }
+            StructuredGraph inlineGraph = providers.getReplacements().getMethodSubstitution(methodCallTargetNode.targetMethod());
+            if (inlineGraph != null) {
+                InliningUtil.inline(methodCallTargetNode.invoke(), inlineGraph, true, null);
             }
         }
 
@@ -519,12 +514,6 @@
                         }
 
                         Replacements replacements = providers.getReplacements();
-                        Class<? extends FixedWithNextNode> macroSubstitution = replacements.getMacroSubstitution(methodCallTargetNode.targetMethod());
-                        if (macroSubstitution != null) {
-                            InliningUtil.inlineMacroNode(methodCallTargetNode.invoke(), methodCallTargetNode.targetMethod(), macroSubstitution);
-                            changed = changedInIteration = true;
-                            continue;
-                        }
                         StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTargetNode.targetMethod());
 
                         ResolvedJavaMethod targetMethod = methodCallTargetNode.targetMethod();
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Fri Mar 27 16:04:23 2015 +0100
@@ -236,12 +236,7 @@
         for (Node newNode : graph.getNewNodes(mark)) {
             if (newNode instanceof MethodCallTargetNode) {
                 MethodCallTargetNode methodCallTargetNode = (MethodCallTargetNode) newNode;
-                Class<? extends FixedWithNextNode> macroSubstitution = providers.getReplacements().getMacroSubstitution(methodCallTargetNode.targetMethod());
-                if (macroSubstitution != null) {
-                    InliningUtil.inlineMacroNode(methodCallTargetNode.invoke(), methodCallTargetNode.targetMethod(), macroSubstitution);
-                } else {
-                    tryCutOffRuntimeExceptionsAndErrors(methodCallTargetNode);
-                }
+                tryCutOffRuntimeExceptionsAndErrors(methodCallTargetNode);
             }
         }
         return graph.getMark();
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java	Fri Mar 27 16:04:23 2015 +0100
@@ -59,15 +59,6 @@
     }
 
     @Override
-    public Class<? extends FixedWithNextNode> getMacroSubstitution(ResolvedJavaMethod method) {
-        Class<? extends FixedWithNextNode> clazz = graalReplacements.getMacroSubstitution(method);
-        if (clazz == null) {
-            return super.getMacroSubstitution(method);
-        }
-        return clazz;
-    }
-
-    @Override
     public Collection<ResolvedJavaMethod> getAllReplacements() {
         throw GraalInternalError.shouldNotReachHere();
     }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/ReplaceIntrinsicsPhase.java	Fri Mar 27 15:37:42 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/ReplaceIntrinsicsPhase.java	Fri Mar 27 16:04:23 2015 +0100
@@ -47,16 +47,10 @@
             if (methodCallTarget.isAlive()) {
                 InvokeKind invokeKind = methodCallTarget.invokeKind();
                 if (invokeKind.isDirect()) {
-                    Class<? extends FixedWithNextNode> macroSubstitution = replacements.getMacroSubstitution(methodCallTarget.targetMethod());
-                    if (macroSubstitution != null) {
-                        InliningUtil.inlineMacroNode(methodCallTarget.invoke(), methodCallTarget.targetMethod(), macroSubstitution);
+                    StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTarget.targetMethod());
+                    if (inlineGraph != null) {
+                        InliningUtil.inline(methodCallTarget.invoke(), inlineGraph, true, null);
                         Debug.dump(graph, "After inlining %s", methodCallTarget.targetMethod().toString());
-                    } else {
-                        StructuredGraph inlineGraph = replacements.getMethodSubstitution(methodCallTarget.targetMethod());
-                        if (inlineGraph != null) {
-                            InliningUtil.inline(methodCallTarget.invoke(), inlineGraph, true, null);
-                            Debug.dump(graph, "After inlining %s", methodCallTarget.targetMethod().toString());
-                        }
                     }
                 }
             }